Module

rendering.plugins.inline_icon

Inline icon plugin for Mistune.

Provides inline icon syntax for use in table cells, paragraphs, etc.

Syntax:

{icon}`terminal`           -> 24px icon (default)
{icon}`terminal:16`        -> 16px icon
{icon}`terminal:32`        -> 32px icon
{icon}`docs:48:primary`    -> 48px icon with class

This works inside table cells and other inline contexts where the block-level :::{icon} directive cannot be used.

Classes

InlineIconPlugin
Mistune plugin for inline icon syntax. Syntax: {icon}`name` -> 24px icon {ico…
4

Mistune plugin for inline icon syntax.

Syntax:

{icon}`name`              -> 24px icon
{icon}`name:size`         -> Custom size (e.g., name:16, name:32)
{icon}`name:size:class`   -> Custom size and CSS class
Internal Methods 4
__init__
Initialize inline icon plugin.
0 None
def __init__(self) -> None

Initialize inline icon plugin.

__call__
Register the plugin with Mistune. Icon substitution happens in parser.py after…
1 Any
def __call__(self, md: Any) -> Any

Register the plugin with Mistune.

Icon substitution happens in parser.py after HTML is generated.

Parameters 1
md Any
Returns

Any

_substitute_icons
Substitute {icon}<code>...</code> patterns with inline SVG. Skips patterns ins…
1 str
def _substitute_icons(self, html: str) -> str

Substitute {icon}<code>...</code> patterns with inline SVG.

Skips patterns inside <pre> code blocks to preserve literal syntax in code examples.

Parameters 1
html str

HTML content that may contain icon patterns

Returns

str

HTML with icon patterns replaced by SVG

_render_icon
Render an icon from the content string.
1 str
def _render_icon(self, content: str) -> str

Render an icon from the content string.

Parameters 1
content str

Icon specification (e.g., "terminal", "docs:32", "bengal-rosette:48:primary")

Returns

str

Inline SVG HTML or fallback indicator

Functions

_get_icons_dir
Get the icons directory path.
0 Path
def _get_icons_dir() -> Path

Get the icons directory path.

Returns

Path

_load_icon
Load an icon SVG by name.
1 str | None
def _load_icon(name: str) -> str | None

Load an icon SVG by name.

Parameters 1

Name Type Default Description
name str

Icon name (without .svg extension)

Returns

str | None

SVG content string, or None if not found