Skip to content

MkBlockQuote

Show source on GitHub

BlockQuote node.

Example: Regular

Jinja

{{ "Some text" | MkBlockQuote }}

Python

MkBlockQuote('Some text')

Some text

> Some text
<blockquote>
<p>Some text</p>
</blockquote>
    Some text
MkBlockQuote
╰── MkText('Some text')

Example: Nested

Jinja

{{ "Nested!" | MkBlockQuote | MkBlockQuote }}

Python

MkContainer([...])

Nested!

Nested!

> Nested!


> > Nested!
<blockquote>
<p>Nested!</p>
<blockquote>
<p>Nested!</p>
</blockquote>
</blockquote>
MkContainer
├── MkBlockQuote('Nested!')
│   ╰── MkText('Nested!')
╰── MkBlockQuote([list([...])])
├── MkBlockQuote('Nested!')
│   ╰── MkText('Nested!')

Bases: MkContainer

Name Children Inherits
MkContainer
mknodes.basenodes.mkcontainer
A node containing other MkNodes.
graph TD
  94721311724224["mkblockquote.MkBlockQuote"]
  94721311697232["mkcontainer.MkContainer"]
  94721308848336["mknode.MkNode"]
  94721311766592["node.Node"]
  140564252373184["builtins.object"]
  94721311697232 --> 94721311724224
  94721308848336 --> 94721311697232
  94721311766592 --> 94721308848336
  140564252373184 --> 94721311766592
/home/runner/work/mknodes/mknodes/mknodes/basenodes/mkblockquote/metadata.toml
[metadata]
icon = "mdi:format-quote-open"
name = "MkBlockQuote"

[examples.regular]
title = "Regular"
jinja = """
{{ "Some text" | MkBlockQuote }}
"""

[examples.nested]
title = "Nested"
description = "We can also nest blocks, they will adjust their delimiters automatically."
jinja = """
{{ "Nested!" | MkBlockQuote | MkBlockQuote }}
"""

[output.markdown]
template = """
{{ node.items | join(node.block_separator) | indent(width="> ", first=True) | rstrip("\n") }}

"""

# [output.html]
# template = """
# <blockquote>
# {{ node.items | join(node.block_separator)  }}
# </blockquote>
# """

[output.rst]
template = """
{{ node.items | join(node.block_separator) | indent(width="    ", first=True) | rstrip("\n") }}

"""
mknodes.basenodes.mkblockquote.MkBlockQuote
class MkBlockQuote(mkcontainer.MkContainer):
    """BlockQuote node."""

    ICON = "material/format-quote-open"
    STATUS = "new"

    def _to_markdown(self) -> str:
        text = super()._to_markdown()
        return textwrap.indent(text, "> ").rstrip("\n") + "\n"