MkReprRawRendered
Node showing a tabbed block to visualize a node in different representations.¶
Description
It contains a tab for the repr, one for the rendered output, one for the markdown and a Repr tree in case the node has children. The node can also be a string with a jinja macro returning an MkNode. In that case a "Jinja" tab containing the macro is prepended to the other tabs.
Example: Regular¶
Info
Some text
!!! info
Some text
===! "Repr"
```` {.python }
MkAdmonition('Some text')
````
=== "Raw"
```` {.markdown }
!!! info
Some text
````
=== "Html"
```` {.html }
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>Some text</p>
</div>
````
===+ "Rendered"
!!! info
Some text
=== "Repr tree"
````
MkAdmonition
╰── MkText('Some text')
````
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>Some text</p>
</div>
<div class="tabbed-set" data-tabs="1:5"><input id="__tabbed_1_1" name="__tabbed_1" type="radio"><label for="__tabbed_1_1">Repr</label><div class="tabbed-content">
<div class="language-python highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="n">MkAdmonition</span><span class="p">(</span><span class="s1">'Some text'</span><span class="p">)</span>
</span></code></pre></div>
</div>
<input id="__tabbed_1_2" name="__tabbed_1" type="radio"><label for="__tabbed_1_2">Raw</label><div class="tabbed-content">
<div class="language-markdown highlight"><pre><span></span><code><span id="__span-1-1"><a id="__codelineno-1-1" name="__codelineno-1-1" href="#__codelineno-1-1"></a>!!! info
</span><span id="__span-1-2"><a id="__codelineno-1-2" name="__codelineno-1-2" href="#__codelineno-1-2"></a> Some text
</span></code></pre></div>
</div>
<input id="__tabbed_1_3" name="__tabbed_1" type="radio"><label for="__tabbed_1_3">Html</label><div class="tabbed-content">
<div class="language-html highlight"><pre><span></span><code><span id="__span-2-1"><a id="__codelineno-2-1" name="__codelineno-2-1" href="#__codelineno-2-1"></a><span class="p"><</span><span class="nt">div</span> <span class="na">class</span><span class="o">=</span><span class="s">"admonition info"</span><span class="p">></span>
</span><span id="__span-2-2"><a id="__codelineno-2-2" name="__codelineno-2-2" href="#__codelineno-2-2"></a><span class="p"><</span><span class="nt">p</span> <span class="na">class</span><span class="o">=</span><span class="s">"admonition-title"</span><span class="p">></span>Info<span class="p"></</span><span class="nt">p</span><span class="p">></span>
</span><span id="__span-2-3"><a id="__codelineno-2-3" name="__codelineno-2-3" href="#__codelineno-2-3"></a><span class="p"><</span><span class="nt">p</span><span class="p">></span>Some text<span class="p"></</span><span class="nt">p</span><span class="p">></span>
</span><span id="__span-2-4"><a id="__codelineno-2-4" name="__codelineno-2-4" href="#__codelineno-2-4"></a><span class="p"></</span><span class="nt">div</span><span class="p">></span>
</span></code></pre></div>
</div>
<input checked id="__tabbed_1_4" name="__tabbed_1" type="radio"><label for="__tabbed_1_4">Rendered</label><div class="tabbed-content">
<div class="admonition info">
<p class="admonition-title">Info</p>
<p>Some text</p>
</div>
</div>
<input id="__tabbed_1_5" name="__tabbed_1" type="radio"><label for="__tabbed_1_5">Repr tree</label><div class="tabbed-content">
<div class="language-text highlight"><pre><span></span><code><span id="__span-3-1"><a id="__codelineno-3-1" name="__codelineno-3-1" href="#__codelineno-3-1"></a>MkAdmonition
</span><span id="__span-3-2"><a id="__codelineno-3-2" name="__codelineno-3-2" href="#__codelineno-3-2"></a>╰── MkText('Some text')
</span></code></pre></div>
</div>
</div>
MkContainer
╰── MkAdmonition('Some text')
╰── MkText('Some text')
╰── MkReprRawRendered(MkAdmonition('Some text'))
├── MkTab(title='Repr', content=MkCode("MkAdmonition('Some text')"), new=True)
│ ╰── MkCode("MkAdmonition('Some text')")
│ ╰── MkText("MkAdmonition('Some text')")
├── MkTab(title='Raw', content=MkCode([list([...])], language='markdown'))
│ ╰── MkCode([list([...])], language='markdown')
│ ╰── MkAdmonition('Some text')
│ ╰── MkText('Some text')
├── MkTab(title='Html', content=MkCode('<div class="admoniti...p>\n</div>', language='html'))
│ ╰── MkCode('<div class="admonition info">\n<p class="admonition-title">Info</p>\n<p>Some text</p>\n</div>', language='html')
│ ╰── MkText('<div class="admonition info">\n<p class="admonition-title">Info</p>\n<p>Some text</p>\n</div>')
├── MkTab(title='Rendered', content=MkAdmonition('Some text'), select=True)
│ ╰── MkAdmonition('Some text')
│ ╰── MkText('Some text')
╰── MkTab(title='Repr tree', content=MkTreeView(MkAdmonition('Some text')))
╰── MkTreeView(MkAdmonition('Some text'))
Name | Children | Inherits |
---|---|---|
MkTemplate mknodes.templatenodes.mktemplate Node representing a jinja template. |
graph TD
94721311818560["mkreprrawrendered.MkReprRawRendered"]
94721308869584["mktemplate.MkTemplate"]
94721311697232["mkcontainer.MkContainer"]
94721308848336["mknode.MkNode"]
94721311766592["node.Node"]
140564252373184["builtins.object"]
94721308869584 --> 94721311818560
94721311697232 --> 94721308869584
94721308848336 --> 94721311697232
94721311766592 --> 94721308848336
140564252373184 --> 94721311766592
/home/runner/work/mknodes/mknodes/mknodes/templatenodes/mkreprrawrendered/metadata.toml
[metadata]
icon = "mdi:presentation"
name = "MkReprRawRendered"
group = "documentation"
virtual_children = true
[examples.regular]
title = "Regular"
jinja = """
{{ "Some text" | MkAdmonition | MkReprRawRendered }}
"""
[output.markdown]
template = """
{% set inspected = node.node %}
{% if inspected %}
{% if node._node is string_like %}
{{ node._node | MkTab(title="Jinja") }}
{% endif %}
{{ inspected | repr | MkCode | MkTab(title="Repr", new=True) }}
{{ inspected | MkCode(language="markdown") | MkTab(title="Raw") }}
{{ inspected | to_html | MkCode(language="html") | MkTab(title="Html") }}
{{ inspected | MkTab(title="Rendered", select=True) }}
{% if inspected.children %}
{{ inspected | MkTreeView | MkTab(title="Repr tree") }}{% endif %}{% endif %}
"""