MkTabbedBlocks
PyMdown Block Extension Tab.¶
Example: Regular¶
Some markdown
Other Markdown
<div class="tabbed-set" data-tabs="1:2"><input checked id="__tabbed_1_1" name="__tabbed_1" type="radio"><label for="__tabbed_1_1">Tab 1</label><div class="tabbed-content">
<p>Some markdown</p>
</div>
<input id="__tabbed_1_2" name="__tabbed_1" type="radio"><label for="__tabbed_1_2">Tab 2</label><div class="tabbed-content">
<p>Other Markdown</p>
</div>
</div>
Example: Nested¶
Jinja
Some markdown
Other Markdown
Info
Nested admonition
Some markdown
Other Markdown
Info
Nested admonition
<div class="tabbed-set" data-tabs="1:2"><input checked id="__tabbed_1_1" name="__tabbed_1" type="radio"><label for="__tabbed_1_1">Tab 1</label><div class="tabbed-content">
<p>Some markdown</p>
</div>
<input id="__tabbed_1_2" name="__tabbed_1" type="radio"><label for="__tabbed_1_2">Tab 2</label><div class="tabbed-content">
<p>Other Markdown</p>
</div>
</div>
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>Nested admonition</p>
</div>
<div class="tabbed-set" data-tabs="2:2"><input checked id="__tabbed_2_1" name="__tabbed_2" type="radio"><label for="__tabbed_2_1">Tabs</label><div class="tabbed-content">
<div class="tabbed-set" data-tabs="3:1"><input checked id="__tabbed_3_1" name="__tabbed_3" type="radio"><label for="__tabbed_3_1">Tab 1</label><div class="tabbed-content">
<p>Some markdown</p>
<div class="tabbed-set" data-tabs="4:1"><input checked id="__tabbed_4_1" name="__tabbed_4" type="radio"><label for="__tabbed_4_1">Tab 2</label><div class="tabbed-content">
<p>Other Markdown</p>
</div>
</div>
</div>
</div>
</div>
<input id="__tabbed_2_2" name="__tabbed_2" type="radio"><label for="__tabbed_2_2">Admonition</label><div class="tabbed-content">
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>Nested admonition</p>
</div>
</div>
</div>
MkContainer
├── MkTabbedBlocks(tabs=[...])
│ ├── MkTabBlock('Some markdown', 'Tab 1', new=True, select=False)
│ │ ╰── MkText('Some markdown')
│ ╰── MkTabBlock('Other Markdown', 'Tab 2', new=False, select=False)
│ ╰── MkText('Other Markdown')
├── MkAdmonition('Nested admonition')
│ ╰── MkText('Nested admonition')
╰── MkTabbedBlocks(tabs=[...])
├── MkTabBlock([list([...])], 'Tabs', new=True, select=False)
├── MkTabbedBlocks(tabs=[...])
│ ├── MkTabBlock('Some markdown', 'Tab 1', new=True, select=False)
│ │ ╰── MkText('Some markdown')
│ ╰── MkTabBlock('Other Markdown', 'Tab 2', new=False, select=False)
│ ╰── MkText('Other Markdown')
│ ╰── MkTabBlock([list([...])], 'Admonition', new=False, select=False)
├── MkAdmonition('Nested admonition')
│ ╰── MkText('Nested admonition')
Name | Children | Inherits |
---|---|---|
MkTabContainer mknodes.basenodes.mktabcontainer Base class for nodes containing tabs. |
graph TD
94721311949312["mktabbedblocks.MkTabbedBlocks"]
94721311947536["mktabcontainer.MkTabContainer"]
94721311697232["mkcontainer.MkContainer"]
94721308848336["mknode.MkNode"]
94721311766592["node.Node"]
140564252373184["builtins.object"]
94721311947536 --> 94721311949312
94721311697232 --> 94721311947536
94721308848336 --> 94721311697232
94721311766592 --> 94721308848336
140564252373184 --> 94721311766592
/home/runner/work/mknodes/mknodes/mknodes/basenodes/mktabbedblocks/metadata.toml
[metadata]
name = "MkTabbedBlocks"
icon = "mdi:tab"
[requirements.extension."pymdownx.blocks.tab"]
[examples.regular]
title = "Regular"
jinja = """
{{ {"Tab 1": "Some markdown", "Tab 2": "Other Markdown"} | MkTabbedBlocks}}
"""
[examples.nested]
title = "Nested"
jinja = """
{% set node = {"Tab 1": "Some markdown", "Tab 2": "Other Markdown"} | MkTabbedBlocks %}
{{ {"Tabs": node, "Admonition": mk.MkAdmonition("Nested admonition")} | MkTabbedBlocks }}
"""
[fragments.tab]
template = """
{{ node.fence_boundary }} tab | {{ node.title }}
{{ node.attributes_block }}
{{ node.content_block }}{{ node.fence_boundary }}
"""
[output.markdown]
template = """
{{ node.items | join(node.block_separator) }}
"""