A Python Markdown extension to convert inline block shorthand syntax into PyMdown Block Extension format
- Convert single-line inline block syntax into fully-formed block syntax.
- Supports modifiers for advanced block formatting.
- Simple and lightweight; integrates easily with Markdown or MkDocs.
The following markdown inline block syntax:

/// attribution: Unknown author
/// figure-caption | < ^1 : CaptionWill be converted to the following PyMdown Block syntax:

/// attribution
Unknown author
///
/// figure-caption | < ^1
Caption
///Install the extension via pip:
pip install pymdownx-inline-blocksTo use the extension, add it to your Markdown or MkDocs configuration:
md = markdown.Markdown(extensions=['inline_blocks'])or, if using MkDocs, add it to your mkdocs.yml:
markdown_extensions:
- inline_blocksThe extension supports the following options:
exclude_blocks: A list of block types to exclude from processing. Default is['html'].delimiter: The delimiter used to separate the block and the content. Default is:.block_delimiter: A dictionary mapping block types to their own default delimiter, overridingdelimiterfor those blocks. Default is{}.
For example, to use ! as the delimiter for caption blocks only:
markdown_extensions:
- inline_blocks:
block_delimiter:
caption: "!"Delimiters must be non-empty strings; otherwise the extension raises a ValueError when it is loaded.
The delimiter can also be set for a single line by writing it right after the slashes, followed by a space. It takes precedence over both options:
///! caption | [style="color: red;"] ! A red caption.