Пример #1
0
def test_github_flavored_markdown_to_html_pre_tag():
    text = u"```python\nprint('hello')\n```"
    result = cmark.github_flavored_markdown_to_html(text)
    assert result == textwrap.dedent("""\
        <pre><code class="language-python">print('hello')
        </code></pre>
        """)
Пример #2
0
def test_github_flavored_markdown_to_html():
    text = u"Hello, https://pypa.io!"
    result = cmark.github_flavored_markdown_to_html(text)
    expected = """
        <p>Hello, <a href="https://pypa.io">https://pypa.io</a>!</p>
    """
    assert _normalize_ws(result) == _normalize_ws(expected)
Пример #3
0
def test_github_flavored_markdown_to_html():
    text = u"Hello, https://pypa.io!"
    result = cmark.github_flavored_markdown_to_html(
        text,
        options=2048)
    assert result == textwrap.dedent("""\
        <p>Hello, <a href="https://pypa.io">https://pypa.io</a>!</p>\n""")
Пример #4
0
def test_github_flavored_markdown_to_html_pre_tag():
    text = u"```python\nprint('hello')\n```"
    result = cmark.github_flavored_markdown_to_html(text)
    expected = """
        <pre lang="python"><code>print('hello')
        </code></pre>
    """
    assert _normalize_ws(result) == _normalize_ws(expected)
Пример #5
0
def test_github_flavored_markdown_to_html_tasklist():
    text = u"- [X] Task 1 Done\n- [ ] Task 2 Incomplete"
    result = cmark.github_flavored_markdown_to_html(text)
    expected = """
        <ul>
        <li><input type="checkbox" checked="" disabled="" /> Task 1 Done</li>
        <li><input type="checkbox" disabled="" /> Task 2 Incomplete</li>
        </ul>
    """
    assert _normalize_ws(result) == _normalize_ws(expected)