Пример #1
0
    def test_strict_mode_valid(self):
        pages = [('index.md', ), ('internal.md', ), ('sub/internal.md')]
        site_nav = nav.SiteNavigation(pages)

        valid = "[test](internal.md)"
        build.convert_markdown(valid, site_nav, strict=False)
        build.convert_markdown(valid, site_nav, strict=True)
Пример #2
0
    def test_strict_mode_valid(self):
        pages = [("index.md",), ("internal.md",), ("sub/internal.md")]
        site_nav = nav.SiteNavigation(pages)

        valid = "[test](internal.md)"
        build.convert_markdown(valid, site_nav, strict=False)
        build.convert_markdown(valid, site_nav, strict=True)
Пример #3
0
    def test_strict_mode_invalid(self):
        pages = [("index.md",), ("internal.md",), ("sub/internal.md")]
        site_nav = nav.SiteNavigation(pages)

        invalid = "[test](bad_link.md)"
        build.convert_markdown(invalid, site_nav, strict=False)

        self.assertRaises(MarkdownNotFound, build.convert_markdown, invalid, site_nav, strict=True)
Пример #4
0
    def test_absolute_link(self):
        pages = [
            'index.md',
            'sub/index.md',
        ]
        site_nav = nav.SiteNavigation(pages)

        markdown = "[test 1](/index.md) [test 2](/sub/index.md)"
        cfg = load_config({'strict': True})
        build.convert_markdown(markdown, cfg, site_nav)
Пример #5
0
    def test_absolute_link(self):
        pages = [
            'index.md',
            'sub/index.md',
        ]
        site_nav = nav.SiteNavigation(pages)

        markdown = "[test 1](/index.md) [test 2](/sub/index.md)"
        cfg = load_config({'strict': True})
        build.convert_markdown(markdown, cfg, site_nav)
Пример #6
0
    def test_strict_mode_valid(self):
        pages = [
            'index.md',
            'internal.md',
            'sub/internal.md',
        ]
        site_nav = nav.SiteNavigation(pages)

        valid = "[test](internal.md)"
        build.convert_markdown(valid, load_config({'strict': False}), site_nav)
        build.convert_markdown(valid, load_config({'strict': True}), site_nav)
Пример #7
0
    def test_strict_mode_valid(self):
        pages = [
            'index.md',
            'internal.md',
            'sub/internal.md',
        ]
        site_nav = nav.SiteNavigation(pages)

        valid = "[test](internal.md)"
        build.convert_markdown(valid, load_config({'strict': False}), site_nav)
        build.convert_markdown(valid, load_config({'strict': True}), site_nav)
Пример #8
0
    def test_strict_mode_invalid(self):
        pages = [('index.md', ), ('internal.md', ), ('sub/internal.md')]
        site_nav = nav.SiteNavigation(pages)

        invalid = "[test](bad_link.md)"
        build.convert_markdown(invalid, site_nav, strict=False)

        self.assertRaises(MarkdownNotFound,
                          build.convert_markdown,
                          invalid,
                          site_nav,
                          strict=True)
Пример #9
0
    def test_strict_mode_invalid(self):
        pages = [
            'index.md',
            'internal.md',
            'sub/internal.md',
        ]
        site_nav = nav.SiteNavigation(pages)

        invalid = "[test](bad_link.md)"
        build.convert_markdown(invalid, load_config({'strict': False}),
                               site_nav)

        self.assertRaises(MarkdownNotFound, build.convert_markdown, invalid,
                          load_config({'strict': True}), site_nav)
Пример #10
0
    def test_strict_mode_invalid(self):
        pages = [
            'index.md',
            'internal.md',
            'sub/internal.md',
        ]
        site_nav = nav.SiteNavigation(pages)

        invalid = "[test](bad_link.md)"
        build.convert_markdown(invalid, load_config({'strict': False}), site_nav)

        self.assertRaises(
            MarkdownNotFound,
            build.convert_markdown, invalid, load_config({'strict': True}), site_nav)
Пример #11
0
    def test_markdown_table_extension(self):
        """
        Ensure that the table extension is supported.
        """

        html, toc, meta = build.convert_markdown(dedent("""
        First Header   | Second Header
        -------------- | --------------
        Content Cell 1 | Content Cell 2
        Content Cell 3 | Content Cell 4
        """))

        expected_html = dedent("""
        <table>
        <thead>
        <tr>
        <th>First Header</th>
        <th>Second Header</th>
        </tr>
        </thead>
        <tbody>
        <tr>
        <td>Content Cell 1</td>
        <td>Content Cell 2</td>
        </tr>
        <tr>
        <td>Content Cell 3</td>
        <td>Content Cell 4</td>
        </tr>
        </tbody>
        </table>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #12
0
    def test_markdown_custom_extension(self):
        """
        Check that an extension applies when requested in the arguments to
        `convert_markdown`.
        """
        md_input = "foo__bar__baz"

        # Check that the plugin is not active when not requested.
        expected_without_smartstrong = "<p>foo<strong>bar</strong>baz</p>"
        html_base, _, _ = build.convert_markdown(md_input)
        self.assertEqual(html_base.strip(), expected_without_smartstrong)

        # Check that the plugin is active when requested.
        expected_with_smartstrong = "<p>foo__bar__baz</p>"
        html_ext, _, _ = build.convert_markdown(md_input, ['smart_strong'])
        self.assertEqual(html_ext.strip(), expected_with_smartstrong)
Пример #13
0
    def test_markdown_custom_extension(self):
        """
        Check that an extension applies when requested in the arguments to
        `convert_markdown`.
        """
        md_input = "foo__bar__baz"

        # Check that the plugin is not active when not requested.
        expected_without_smartstrong = "<p>foo<strong>bar</strong>baz</p>"
        html_base, _, _ = build.convert_markdown(md_input)
        self.assertEqual(html_base.strip(), expected_without_smartstrong)

        # Check that the plugin is active when requested.
        expected_with_smartstrong = "<p>foo__bar__baz</p>"
        html_ext, _, _ = build.convert_markdown(md_input, extensions=['smart_strong'])
        self.assertEqual(html_ext.strip(), expected_with_smartstrong)
Пример #14
0
 def test_markdown_duplicate_custom_extension(self):
     """
     Duplicated extension names should not cause problems.
     """
     md_input = "foo"
     html_ext, _, _ = build.convert_markdown(md_input, ['toc'])
     self.assertEqual(html_ext.strip(), '<p>foo</p>')
Пример #15
0
    def test_markdown_table_extension(self):
        """
        Ensure that the table extension is supported.
        """

        html, toc, meta = build.convert_markdown(
            dedent("""
        First Header   | Second Header
        -------------- | --------------
        Content Cell 1 | Content Cell 2
        Content Cell 3 | Content Cell 4
        """))

        expected_html = dedent("""
        <table>
        <thead>
        <tr>
        <th>First Header</th>
        <th>Second Header</th>
        </tr>
        </thead>
        <tbody>
        <tr>
        <td>Content Cell 1</td>
        <td>Content Cell 2</td>
        </tr>
        <tr>
        <td>Content Cell 3</td>
        <td>Content Cell 4</td>
        </tr>
        </tbody>
        </table>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #16
0
 def test_not_use_directory_urls(self):
     md_text = "An [internal link](internal.md) to another document."
     expected = '<p>An <a href="internal/index.html">internal link</a> to another document.</p>'
     pages = [("internal.md",)]
     site_navigation = nav.SiteNavigation(pages, use_directory_urls=False)
     html, toc, meta = build.convert_markdown(md_text, site_navigation=site_navigation)
     self.assertEqual(html.strip(), expected.strip())
Пример #17
0
    def test_convert_markdown(self):
        """
        Ensure that basic Markdown -> HTML and TOC works.
        """

        html, toc, meta = build.convert_markdown(
            dedent("""
            page_title: custom title

            # Heading 1

            This is some text.

            # Heading 2

            And some more text.
        """))

        expected_html = dedent("""
            <h1 id="heading-1">Heading 1</h1>
            <p>This is some text.</p>
            <h1 id="heading-2">Heading 2</h1>
            <p>And some more text.</p>
        """)

        expected_toc = dedent("""
            Heading 1 - #heading-1
            Heading 2 - #heading-2
        """)

        expected_meta = {'page_title': ['custom title']}

        self.assertEqual(html.strip(), expected_html)
        self.assertEqual(str(toc).strip(), expected_toc)
        self.assertEqual(meta, expected_meta)
Пример #18
0
    def html_docs(self):
        text = self.raw_docs
        if not text:
            return ''

        text = _pre_process_objects(text)
        return build.convert_markdown(text, extensions=config.base_config.get('markdown_extensions', []))[0]
Пример #19
0
 def test_markdown_duplicate_custom_extension(self):
     """
     Duplicated extension names should not cause problems.
     """
     md_input = "foo"
     html_ext, _, _ = build.convert_markdown(md_input, ['toc'])
     self.assertEqual(html_ext.strip(), '<p>foo</p>')
Пример #20
0
    def test_convert_markdown(self):
        """
        Ensure that basic Markdown -> HTML and TOC works.
        """

        html, toc, meta = build.convert_markdown(dedent("""
            page_title: custom title

            # Heading 1

            This is some text.

            # Heading 2

            And some more text.
        """))

        expected_html = dedent("""
            <h1 id="heading-1">Heading 1</h1>
            <p>This is some text.</p>
            <h1 id="heading-2">Heading 2</h1>
            <p>And some more text.</p>
        """)

        expected_toc = dedent("""
            Heading 1 - #heading-1
            Heading 2 - #heading-2
        """)

        expected_meta = {'page_title': ['custom title']}

        self.assertEqual(html.strip(), expected_html)
        self.assertEqual(str(toc).strip(), expected_toc)
        self.assertEqual(meta, expected_meta)
Пример #21
0
 def test_not_use_directory_urls(self):
     md_text = 'An [internal link](internal.md) to another document.'
     expected = '<p>An <a href="internal/index.html">internal link</a> to another document.</p>'
     pages = [('internal.md', )]
     site_navigation = nav.SiteNavigation(pages, use_directory_urls=False)
     html, toc, meta = build.convert_markdown(
         md_text, site_navigation=site_navigation)
     self.assertEqual(html.strip(), expected.strip())
Пример #22
0
    def test_anchor_only_link(self):

        pages = [("index.md",), ("internal.md",), ("sub/internal.md")]

        site_navigation = nav.SiteNavigation(pages)

        for page in site_navigation.walk_pages():
            markdown = "[test](#test)"
            html, _, _ = build.convert_markdown(markdown, site_navigation=site_navigation)
            self.assertEqual(html, '<p><a href="#test">test</a></p>')
Пример #23
0
 def test_ignore_email_links(self):
     md_text = 'A <*****@*****.**> and an [link](mailto:[email protected]).'
     expected = ''.join([
         '<p>A <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#97;&#117;&#116;',
         '&#111;&#108;&#105;&#110;&#107;&#64;&#101;&#120;&#97;&#109;&#112;&#108;',
         '&#101;&#46;&#99;&#111;&#109;">&#97;&#117;&#116;&#111;&#108;&#105;&#110;',
         '&#107;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;',
         '</a> and an <a href="mailto:[email protected]">link</a>.</p>'
     ])
     html, toc, meta = build.convert_markdown(md_text, load_config())
     self.assertEqual(html.strip(), expected.strip())
Пример #24
0
 def test_ignore_email_links(self):
     md_text = 'A <*****@*****.**> and an [link](mailto:[email protected]).'
     expected = ''.join([
         '<p>A <a href="&#109;&#97;&#105;&#108;&#116;&#111;&#58;&#97;&#117;&#116;',
         '&#111;&#108;&#105;&#110;&#107;&#64;&#101;&#120;&#97;&#109;&#112;&#108;',
         '&#101;&#46;&#99;&#111;&#109;">&#97;&#117;&#116;&#111;&#108;&#105;&#110;',
         '&#107;&#64;&#101;&#120;&#97;&#109;&#112;&#108;&#101;&#46;&#99;&#111;&#109;',
         '</a> and an <a href="mailto:[email protected]">link</a>.</p>'
     ])
     html, toc, meta = build.convert_markdown(md_text, load_config())
     self.assertEqual(html.strip(), expected.strip())
Пример #25
0
    def test_anchor_only_link(self):

        pages = [('index.md', ), ('internal.md', ), ('sub/internal.md')]

        site_navigation = nav.SiteNavigation(pages)

        for page in site_navigation.walk_pages():
            markdown = '[test](#test)'
            html, _, _ = build.convert_markdown(
                markdown, site_navigation=site_navigation)
            self.assertEqual(html, '<p><a href="#test">test</a></p>\n')
Пример #26
0
    def test_anchor_only_link(self):
        pages = [
            'index.md',
            'internal.md',
            'sub/internal.md',
        ]

        site_navigation = nav.SiteNavigation(pages)

        for page in site_navigation.walk_pages():
            markdown = '[test](#test)'
            html, _, _ = build.convert_markdown(markdown, load_config(), site_navigation=site_navigation)
            self.assertEqual(html, '<p><a href="#test">test</a></p>')
Пример #27
0
    def test_convert_internal_asbolute_media(self):
        """Test absolute image URL's are correct for different base_urls"""
        pages = [("index.md",), ("internal.md",), ("sub/internal.md")]

        site_navigation = nav.SiteNavigation(pages)

        expected_results = ("./img/initial-layout.png", "../img/initial-layout.png", "../../img/initial-layout.png")

        template = '<p><img alt="The initial MkDocs layout" src="%s" /></p>'

        for (page, expected) in zip(site_navigation.walk_pages(), expected_results):
            md_text = "![The initial MkDocs layout](/img/initial-layout.png)"
            html, _, _ = build.convert_markdown(md_text, site_navigation=site_navigation)
            self.assertEqual(html, template % expected)
Пример #28
0
    def test_markdown_fenced_code_extension(self):
        """
        Ensure that the fenced code extension is supported.
        """
        html, toc, meta = build.convert_markdown(dedent("""
        ```
        print 'foo'
        ```
        """), load_config())

        expected_html = dedent("""
        <pre><code>print 'foo'\n</code></pre>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #29
0
    def test_dont_convert_code_block_urls(self):
        pages = [('index.md', ), ('internal.md', ), ('sub/internal.md')]

        site_navigation = nav.SiteNavigation(pages)

        expected = dedent("""
        <p>An HTML Anchor::</p>
        <pre><code>&lt;a href="index.md"&gt;My example link&lt;/a&gt;
        </code></pre>
        """)

        for page in site_navigation.walk_pages():
            markdown = 'An HTML Anchor::\n\n    <a href="index.md">My example link</a>\n'
            html, _, _ = build.convert_markdown(
                markdown, site_navigation=site_navigation)
            self.assertEqual(dedent(html), expected)
Пример #30
0
    def test_markdown_fenced_code_extension(self):
        """
        Ensure that the fenced code extension is supported.
        """
        html, toc, meta = build.convert_markdown(
            dedent("""
        ```
        print 'foo'
        ```
        """), load_config())

        expected_html = dedent("""
        <pre><code>print 'foo'\n</code></pre>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #31
0
    def test_convert_internal_media(self):
        pages = [('index.md', ), ('internal.md', ), ('sub/internal.md')]

        site_navigation = nav.SiteNavigation(pages)

        expected_results = (
            '<p><img alt="The initial MkDocs layout" src="./img/initial-layout.png" /></p>\n',
            '<p><img alt="The initial MkDocs layout" src="../img/initial-layout.png" /></p>\n',
            '<p><img alt="The initial MkDocs layout" src="../../img/initial-layout.png" /></p>\n',
        )

        for (page, expected) in zip(site_navigation.walk_pages(),
                                    expected_results):
            md_text = '![The initial MkDocs layout](img/initial-layout.png)'
            html, _, _ = build.convert_markdown(
                md_text, site_navigation=site_navigation)
            self.assertEqual(html, expected)
Пример #32
0
    def test_dont_convert_code_block_urls(self):
        pages = [("index.md",), ("internal.md",), ("sub/internal.md")]

        site_navigation = nav.SiteNavigation(pages)

        expected = dedent(
            """
        <p>An HTML Anchor::</p>
        <pre><code>&lt;a href="index.md"&gt;My example link&lt;/a&gt;
        </code></pre>
        """
        )

        for page in site_navigation.walk_pages():
            markdown = 'An HTML Anchor::\n\n    <a href="index.md">My example link</a>\n'
            html, _, _ = build.convert_markdown(markdown, site_navigation=site_navigation)
            self.assertEqual(dedent(html), expected)
Пример #33
0
    def test_extension_config(self):
        """
        Test that a dictionary of 'markdown_extensions' is recognized as
        both a list of extensions and a dictionary of extnesion configs.
        """
        markdown_extensions = {
            'toc': {'permalink': True},
            'meta': None  # This gets ignored as it is an invalid config
        }
        html, toc, meta = build.convert_markdown(dedent("""
        # A Header
        """), extensions=markdown_extensions)

        expected_html = dedent("""
        <h1 id="a-header">A Header<a class="headerlink" href="#a-header" title="Permanent link">&para;</a></h1>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #34
0
    def test_extension_config(self):
        """
        Test that a dictionary of 'markdown_extensions' is recognized as
        both a list of extensions and a dictionary of extnesion configs.
        """
        markdown_extensions = {
            'toc': {'permalink': True},
            'meta': None  # This gets ignored as it is an invalid config
        }
        html, toc, meta = build.convert_markdown(dedent("""
        # A Header
        """), extensions=markdown_extensions)

        expected_html = dedent("""
        <h1 id="a-header">A Header<a class="headerlink" href="#a-header" title="Permanent link">&para;</a></h1>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #35
0
    def test_extension_config(self):
        """
        Test that a dictionary of 'markdown_extensions' is recognized as
        both a list of extensions and a dictionary of extnesion configs.
        """
        cfg = load_config({
            'markdown_extensions': [{'toc': {'permalink': True}}]
        })

        html, toc, meta = build.convert_markdown(dedent("""
        # A Header
        """), cfg)

        expected_html = dedent("""
        <h1 id="a-header">A Header<a class="headerlink" href="#a-header" title="Permanent link">&para;</a></h1>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #36
0
    def test_convert_internal_media(self):
        pages = [
            ('index.md',),
            ('internal.md',),
            ('sub/internal.md')
        ]

        site_navigation = nav.SiteNavigation(pages)

        expected_results = (
            '<p><img alt="The initial MkDocs layout" src="./img/initial-layout.png" /></p>\n',
            '<p><img alt="The initial MkDocs layout" src="../img/initial-layout.png" /></p>\n',
            '<p><img alt="The initial MkDocs layout" src="../../img/initial-layout.png" /></p>\n',
        )

        for (page, expected) in zip(site_navigation.walk_pages(), expected_results):
            md_text = '![The initial MkDocs layout](img/initial-layout.png)'
            html, _, _ = build.convert_markdown(md_text, site_navigation=site_navigation)
            self.assertEqual(html, expected)
Пример #37
0
    def test_convert_internal_asbolute_media(self):
        """Test absolute image URL's are correct for different base_urls"""
        pages = [('index.md', ), ('internal.md', ), ('sub/internal.md')]

        site_navigation = nav.SiteNavigation(pages)

        expected_results = (
            './img/initial-layout.png',
            '../img/initial-layout.png',
            '../../img/initial-layout.png',
        )

        template = '<p><img alt="The initial MkDocs layout" src="%s" /></p>\n'

        for (page, expected) in zip(site_navigation.walk_pages(),
                                    expected_results):
            md_text = '![The initial MkDocs layout](/img/initial-layout.png)'
            html, _, _ = build.convert_markdown(
                md_text, site_navigation=site_navigation)
            self.assertEqual(html, template % expected)
Пример #38
0
    def test_convert_internal_media(self):
        """Test relative image URL's are the same for different base_urls"""
        pages = [
            ('index.md',),
            ('internal.md',),
            ('sub/internal.md')
        ]

        site_navigation = nav.SiteNavigation(pages)

        expected_results = (
            './img/initial-layout.png',
            '../img/initial-layout.png',
            '../img/initial-layout.png',
        )

        template = '<p><img alt="The initial MkDocs layout" src="%s" /></p>'

        for (page, expected) in zip(site_navigation.walk_pages(), expected_results):
            md_text = '![The initial MkDocs layout](img/initial-layout.png)'
            html, _, _ = build.convert_markdown(md_text, site_navigation=site_navigation)
            self.assertEqual(html, template % expected)
Пример #39
0
    def test_extension_config(self):
        """
        Test that a dictionary of 'markdown_extensions' is recognized as
        both a list of extensions and a dictionary of extnesion configs.
        """
        cfg = load_config(
            {'markdown_extensions': [{
                'toc': {
                    'permalink': True
                }
            }]})

        html, toc, meta = build.convert_markdown(
            dedent("""
        # A Header
        """), cfg)

        expected_html = dedent("""
        <h1 id="a-header">A Header<a class="headerlink" href="#a-header" title="Permanent link">&para;</a></h1>
        """)

        self.assertEqual(html.strip(), expected_html)
Пример #40
0
    def test_empty_document(self):
        html, toc, meta = build.convert_markdown("")

        self.assertEqual(html, '')
        self.assertEqual(len(list(toc)), 0)
        self.assertEqual(meta, {})
Пример #41
0
 def test_ignore_external_link(self):
     md_text = 'An [external link](http://example.com/external.md).'
     expected = '<p>An <a href="http://example.com/external.md">external link</a>.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     self.assertEqual(html.strip(), expected.strip())
Пример #42
0
 def test_convert_multiple_internal_links(self):
     md_text = '[First link](first.md) [second link](second.md).'
     expected = '<p><a href="first/">First link</a> <a href="second/">second link</a>.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     html = build.post_process_html(html)
     self.assertEqual(html.strip(), expected.strip())
Пример #43
0
 def test_convert_internal_link_with_anchor(self):
     md_text = 'An [internal link](internal.md#section1.1) to another document.'
     expected = '<p>An <a href="internal/#section1.1">internal link</a> to another document.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     self.assertEqual(html.strip(), expected.strip())
Пример #44
0
 def test_convert_internal_link_differing_directory(self):
     md_text = 'An [internal link](../internal.md) to another document.'
     expected = '<p>An <a href="../internal/">internal link</a> to another document.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     self.assertEqual(html.strip(), expected.strip())
Пример #45
0
 def test_convert_multiple_internal_links(self):
     md_text = '[First link](first.md) [second link](second.md).'
     expected = '<p><a href="first/">First link</a> <a href="second/">second link</a>.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     self.assertEqual(html.strip(), expected.strip())
Пример #46
0
 def test_convert_internal_link_differing_directory(self):
     md_text = 'An [internal link](../internal.md) to another document.'
     expected = '<p>An <a href="../internal/">internal link</a> to another document.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     html = build.post_process_html(html)
     self.assertEqual(html.strip(), expected.strip())
Пример #47
0
    def test_empty_document(self):
        html, toc, meta = build.convert_markdown("")

        self.assertEqual(html, '')
        self.assertEqual(len(list(toc)), 0)
        self.assertEqual(meta, {})
Пример #48
0
 def test_convert_internal_link_with_anchor(self):
     md_text = 'An [internal link](internal.md#section1.1) to another document.'
     expected = '<p>An <a href="internal/#section1.1">internal link</a> to another document.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     html = build.post_process_html(html)
     self.assertEqual(html.strip(), expected.strip())
Пример #49
0
 def test_ignore_external_link(self):
     md_text = 'An [external link](http://example.com/external.md).'
     expected = '<p>An <a href="http://example.com/external.md">external link</a>.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     html = build.post_process_html(html)
     self.assertEqual(html.strip(), expected.strip())
Пример #50
0
 def test_convert_internal_link(self):
     md_text = 'An [internal link](internal.md) to another document.'
     expected = '<p>An <a href="internal/">internal link</a> to another document.</p>'
     html, toc, meta = build.convert_markdown(md_text)
     self.assertEqual(html.strip(), expected.strip())
Пример #51
0
 def test_convert_internal_link(self):
     md_text = 'An [internal link](internal.md) to another document.'
     expected = '<p>An <a href="internal/">internal link</a> to another document.</p>'
     html, toc, meta = build.convert_markdown(md_text, load_config())
     self.assertEqual(html.strip(), expected.strip())