Classes
CodeTabsOptions
dataclass
Options for code-tabs directive (currently none).
CodeTabsOptions
dataclass Options for code-tabs directive (currently none).
Inherits from
DirectiveOptions
CodeTabsDirective
Code tabs for multi-language examples.
Syntax:
````{code-tabs}
### Tab: Python
```pyt…
CodeTabsDirective
Code tabs for multi-language examples.
Syntax:
````{code-tabs}
### Tab: Python
```python
# Example code here
```
### Tab: JavaScript
```javascript
console.log("hello")
```
````
Aliases: code-tabs, code_tabs
Inherits from
BengalDirectiveAttributes
| Name | Type | Description |
|---|---|---|
NAMES |
ClassVar[list[str]] |
|
TOKEN_TYPE |
ClassVar[str] |
|
OPTIONS_CLASS |
ClassVar[type[DirectiveOptions]] |
|
DIRECTIVE_NAMES |
ClassVar[list[str]] |
Methods 2
parse_directive
Build code tabs token by parsing tab markers in content.
Note: Returns dict in…
parse_directive
def parse_directive(self, title: str, options: CodeTabsOptions, content: str, children: list[Any], state: Any) -> dict[str, Any]
Build code tabs token by parsing tab markers in content.
Note: Returns dict instead of DirectiveToken because children are custom code_tab_item tokens, not parsed markdown.
Parameters 5
title |
str |
|
options |
CodeTabsOptions |
|
content |
str |
|
children |
list[Any] |
|
state |
Any |
Returns
dict[str, Any]
render
Render code tabs to HTML.
render
def render(self, renderer: Any, text: str, **attrs: Any) -> str
Render code tabs to HTML.
Parameters 2
renderer |
Any |
|
text |
str |
Returns
str
Functions
render_code_tabs
Legacy render function for backward compatibility.
render_code_tabs
def render_code_tabs(renderer: Any, text: str, **attrs: Any) -> str
Legacy render function for backward compatibility.
Parameters 2
| Name | Type | Default | Description |
|---|---|---|---|
renderer |
Any |
— | |
text |
str |
— |
Returns
str
render_code_tab_item
Render code tab item marker (used internally).
render_code_tab_item
def render_code_tab_item(renderer: Any, **attrs: Any) -> str
Render code tab item marker (used internally).
Parameters 1
| Name | Type | Default | Description |
|---|---|---|---|
renderer |
Any |
— |
Returns
str