# ‹› `` `markdown.extensions.fenced_code`

This extension adds Fenced Code Blocks to Python-Markdown.

See the documentation for details.

Classes:

- `FencedCodeExtension` –
- `FencedBlockPreprocessor` –

  Find and extract fenced code blocks.

## ‹› `` `markdown.extensions.fenced_code.FencedCodeExtension(**kwargs)`

Bases: `Extension`

Methods:

- `extendMarkdown` –

  Register the processor.

Attributes:

- `config` –

  Default configuration options.

### ‹› `` `markdown.extensions.fenced_code.FencedCodeExtension.config` `instance-attribute`

Default configuration options.

Defined Value:

    self.config = {
        'lang_prefix': ['language-', 'Prefix prepended to the language. Default: "language-"']
    }

### ‹› `` `markdown.extensions.fenced_code.FencedCodeExtension.extendMarkdown(md)`

Register the processor.

Class Instance | Registry | Name | Priority
--- | --- | --- | ---
`FencedBlockPreprocessor` | `blockprocessors` | `fenced_code_block` | `25`

## ‹› `` `markdown.extensions.fenced_code.FencedBlockPreprocessor(md: Markdown, config: dict[str, Any])`

Bases: `Preprocessor`

Find and extract fenced code blocks.

Methods:

- `run` –

  Match and store Fenced Code Blocks in the `HtmlStash`.

- `handle_attrs` –

  Return tuple: `(id, [list, of, classes], {configs})`

### ‹› `` `markdown.extensions.fenced_code.FencedBlockPreprocessor.run(lines: list[str]) -> list[str]`

Match and store Fenced Code Blocks in the `HtmlStash`.

### ‹› `` `markdown.extensions.fenced_code.FencedBlockPreprocessor.handle_attrs(attrs: Iterable[tuple[str, str]]) -> tuple[str, list[str], dict[str, Any]]`

Return tuple: `(id, [list, of, classes], {configs})`