Classes
MathRole
4
▼
Handler for {math}`expression` role.
Renders inline mathematical expressions. The output format
de…
MathRole
4
▼
Handler for \(expression\) role.
Renders inline mathematical expressions. The output format depends on the math rendering library configured (MathJax, KaTeX, etc.).
Syntax:
{math}`E = mc^2`
{math}`\sum_{i=1}^n x_i`
Thread Safety:
Stateless handler. Safe for concurrent use.
Attributes
| Name | Type | Description |
|---|---|---|
names |
ClassVar[tuple[str, ...]]
|
— |
token_type |
ClassVar[str]
|
— |
Methods
parse
3
Role
▼
Parse math role content.
Content is preserved as-is for math rendering.
parse
3
Role
▼
def parse(self, name: str, content: str, location: SourceLocation) -> Role
Parameters
| Name | Type | Description |
|---|---|---|
name |
— |
|
content |
— |
|
location |
— |
Returns
Role
render
2
▼
Render math expression.
Uses span with math class for CSS styling and JS rende…
render
2
▼
def render(self, node: Role, sb: StringBuilder) -> None
Render math expression.
Uses span with math class for CSS styling and JS rendering. The content is escaped but wrapped in delimiters for the math rendering library.
Parameters
| Name | Type | Description |
|---|---|---|
node |
— |
|
sb |
— |