Classes
InlineIconPlugin
Mistune plugin for inline icon syntax.
Syntax:
{icon}`name` -> 24px icon
{ico…
InlineIconPlugin
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.
__init__
def __init__(self) -> None
Initialize inline icon plugin.
__call__
Register the plugin with Mistune.
Icon substitution happens in parser.py after…
__call__
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…
_substitute_icons
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
HTML with icon patterns replaced by SVGstr
—
_render_icon
Render an icon from the content string.
_render_icon
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
Inline SVG HTML or fallback indicatorstr
—
Functions
_get_icons_dir
Get the icons directory path.
_get_icons_dir
def _get_icons_dir() -> Path
Get the icons directory path.
Returns
Path
_load_icon
Load an icon SVG by name.
_load_icon
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
SVG content string, or None if not foundstr | None
—