Classes
PatitasPlugin
4
▼
Protocol for Patitas plugins.
Plugins can hook into multiple extension points:
- extend_lexer: Add…
PatitasPlugin
4
▼
Protocol for Patitas plugins.
Plugins can hook into multiple extension points:
- extend_lexer: Add token types and scanning logic
- extend_parser: Add parsing rules for new tokens
- extend_renderer: Add rendering methods for new nodes
Thread Safety:
Plugins must be stateless. All state should be in AST nodes.
Methods
name
0
str
▼
Plugin identifier.
property
name
0
str
▼
def name(self) -> str
Returns
str
extend_lexer
1
▼
Extend lexer with additional token scanning.
Called once at parser configurati…
extend_lexer
1
▼
def extend_lexer(self, lexer_class: type[Lexer]) -> None
Extend lexer with additional token scanning.
Called once at parser configuration time. Should add methods or modify class behavior.
Parameters
| Name | Type | Description |
|---|---|---|
lexer_class |
— |
extend_parser
1
▼
Extend parser with additional parsing rules.
Called once at parser configurati…
extend_parser
1
▼
def extend_parser(self, parser_class: type[Parser]) -> None
Extend parser with additional parsing rules.
Called once at parser configuration time. Should add methods or modify class behavior.
Parameters
| Name | Type | Description |
|---|---|---|
parser_class |
— |
extend_renderer
1
▼
Extend renderer with additional render methods.
Called once at parser configur…
extend_renderer
1
▼
def extend_renderer(self, renderer_class: type[HtmlRenderer]) -> None
Extend renderer with additional render methods.
Called once at parser configuration time. Should add methods for new node types.
Parameters
| Name | Type | Description |
|---|---|---|
renderer_class |
— |
Functions
register_plugin
1
type[PatitasPlugin]
▼
Decorator to register a plugin.
**Usage:**
@register_plugin("table")
class…
register_plugin
1
type[PatitasPlugin]
▼
def register_plugin(name: str) -> type[PatitasPlugin]
Decorator to register a plugin.
Usage: @register_plugin("table") class TablePlugin: ...
Parameters
| Name | Type | Description |
|---|---|---|
name |
str |
Plugin name for lookup |
Returns
type[PatitasPlugin]
get_plugin
1
PatitasPlugin
▼
Get a plugin instance by name.
get_plugin
1
PatitasPlugin
▼
def get_plugin(name: str) -> PatitasPlugin
Parameters
| Name | Type | Description |
|---|---|---|
name |
str |
Plugin name (e.g., "table", "strikethrough") |
Returns
PatitasPlugin
apply_plugins
4
None
▼
Apply plugins to parser components.
apply_plugins
4
None
▼
def apply_plugins(plugins: list[str], lexer_class: type[Lexer], parser_class: type[Parser], renderer_class: type[HtmlRenderer]) -> None
Parameters
| Name | Type | Description |
|---|---|---|
plugins |
list[str] |
List of plugin names to apply |
lexer_class |
type[Lexer] |
Lexer class to extend |
parser_class |
type[Parser] |
Parser class to extend |
renderer_class |
type[HtmlRenderer] |
Renderer class to extend |