Skip to content

Indented <script> tags are parsed as Markdown instead of being skipped. #1471

@nbanyan

Description

@nbanyan

My scenario:

I'm using PyMdown Extensions' snippets to insert a fenced code block containing a bash command. The same snippet has a <script> block to pull data from another file (using the same snippet extension) to ensure the command is always accurate.
This works, but breaks if used inside any Markdown block element, such as a list.

Sample test function:

    def testBlockInput(self):
        """ Test whether script block is ignored. """
        script = '''* Testing indented script block
    <script>
        if (1 < 2 && 3 > 1) {
            console.log("Success `conditional`!");
        }
    </script>'''
        parsed_script = '''<ul>
<li>Testing indented script block
    <script>
        if (1 < 2 && 3 > 1) {
            console.log("Success `conditional`!");
        }
    </script></li>
</ul>'''
        self.assertEqual(self.md.convert(script), parsed_script)

Metadata

Metadata

Assignees

No one assigned

    Labels

    supportSupport request.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions