Classes
AdmonitionOptions
dataclass
Options for admonition directive.
AdmonitionOptions
dataclass Options for admonition directive.
DirectiveOptionsAttributes
| Name | Type | Description |
|---|---|---|
css_class |
str |
Additional CSS classes |
_field_aliases |
ClassVar[dict[str, str]] |
AdmonitionDirective
Admonition directive using Mistune's fenced syntax.
Syntax:
:::{note} Optional Title
Conte…
AdmonitionDirective
Admonition directive using Mistune's fenced syntax.
Syntax:
:::{note} Optional Title
Content with **markdown** support.
:::
With custom classes:
:::{note} Optional Title
:class: holo custom-class
Content with **markdown** support.
:::
Supported types: note, tip, warning, danger, error, info, example, success, caution, seealso
BengalDirectiveAttributes
| Name | Type | Description |
|---|---|---|
NAMES |
ClassVar[list[str]] |
|
TOKEN_TYPE |
ClassVar[str] |
|
OPTIONS_CLASS |
ClassVar[type[DirectiveOptions]] |
|
DIRECTIVE_NAMES |
ClassVar[list[str]] |
|
ADMONITION_TYPES |
ClassVar[list[str]] |
Methods 3
parse_directive
Build admonition token from parsed components.
Note: The admonition type is pa…
parse_directive
def parse_directive(self, title: str, options: AdmonitionOptions, content: str, children: list[Any], state: Any) -> DirectiveToken
Build admonition token from parsed components.
Note: The admonition type is passed through state to avoid instance attribute mutation which could cause issues in concurrent scenarios.
Parameters 5
title |
str |
|
options |
AdmonitionOptions |
|
content |
str |
|
children |
list[Any] |
|
state |
Any |
Returns
DirectiveToken
parse
Override parse to capture admonition type before calling parent.
The admonitio…
parse
def parse(self, block: Any, m: Any, state: Any) -> dict[str, Any]
Override parse to capture admonition type before calling parent.
The admonition type (note, tip, warning, etc.) comes from parse_type(). State is used instead of instance attributes to avoid concurrency issues.
Parameters 3
block |
Any |
|
m |
Any |
|
state |
Any |
Returns
dict[str, Any]
render
Render admonition to HTML.
render
def render(self, renderer: Any, text: str, **attrs: Any) -> str
Render admonition to HTML.
Parameters 2
renderer |
Any |
|
text |
str |
Returns
str
Functions
_render_admonition_icon
Render admonition icon using Phosphor icons.
_render_admonition_icon
def _render_admonition_icon(icon_name: str) -> str
Render admonition icon using Phosphor icons.
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
icon_name |
str |
— |
Returns
str
render_admonition
Legacy render function for backward compatibility.
render_admonition
def render_admonition(renderer: Any, text: str, admon_type: str, title: str, extra_class: str = '') -> str
Legacy render function for backward compatibility.
Parameters 5
| Name | Type | Default | Description |
|---|---|---|---|
renderer |
Any |
— | |
text |
str |
— | |
admon_type |
str |
— | |
title |
str |
— | |
extra_class |
str |
'' |
Returns
str