예제 #1
0
def test_front_matter(renderer):
    output = renderer.render(text_to_tokens("---\na: 1\nb: 2\nc: 3\n---"))
    assert output.splitlines() == [
        '<div class="myst-front-matter"><pre><code class="language-yaml">a: 1',
        "b: 2",
        "c: 3",
        "</code></pre></div>",
    ]
예제 #2
0
def test_text_to_tokens():
    root = text_to_tokens("abc")
    document = render_tokens(
        root,
        SphinxRenderer,
        load_sphinx_env=True,
        sphinx_conf={"project": "MyST Parser"},
    )
    assert document.pformat() == (
        '<document source="notset">\n    <paragraph>\n        abc\n'
    )
예제 #3
0
def test_block_break(renderer):
    output = renderer.render(text_to_tokens("+++ abc"))
    assert output.splitlines() == [
        "<!-- myst-block-data abc -->",
        '<hr class="myst-block-break" />',
    ]
예제 #4
0
def test_render_tokens():
    root = text_to_tokens("abc")
    assert render_tokens(root, HTMLRenderer) == "<p>abc</p>\n"
예제 #5
0
def test_render_tokens():
    root = text_to_tokens("abc")
    assert isinstance(root, Document)
    assert root.children, root.children