Skip to content

A list in a footnote body generates invalid HTML #412

@georgthegreat

Description

@georgthegreat

Assuming the following markdown:

Some text[^1]

[^1]: 
    1.  The top couple half figure, contrary sides and hands across with bottom couple,

        Half figure back on your own sides, and turn partner to places,

        Swing partners with right hands into straight line long-ways, as in a reel, and

        Set,

        Hey and return to places,

        The other three couples do the same.

    2.  Top and bottom couples meet and set,

        Then each gentleman leas the opposite lady to the couple on his left, and set,

        Aach four right and left,

        Swing side couples to places, and turn partners all eight,

        The other two couple o the same.

Converting it as follows:

md = markdown.Markdown(extensions=["footnotes"], output="xhtml5")
md.convert(data)

Gives the following HTML (I've added head and body tags, pretty-printed the stuff

<html>
    <body>
        <p>Some text<sup id="fnref:1">
                <a class="footnote-ref" href="#fn:1" rel="footnote">1</a>
            </sup>
        </p>
        <div class="footnote">
            <hr />
            <ol>
                <li id="fn:1">
                    <ol>
                        <li>The top couple half figure, contrary sides and hands across with bottom couple,</li>
                        <p>Half figure back on your own sides, and turn partner to places,</p>
                        <p>Swing partners with right hands into straight line long-ways, as in a reel, and</p>
                        <p>Set,</p>
                        <p>Hey and return to places,</p>
                        <p>
                            <p>The other three couples do the same.</p>
                        </p>
                        <li>
                            <p>Top and bottom couples meet and set,</p>
                        </li>
                        <p>Then each gentleman leas the opposite lady to the couple on his left, and set,</p>
                        <p>Aach four right and left,</p>
                        <p>Swing side couples to places, and turn partners all eight,</p>
                        <p>The other two couple o the same.</p>
                    </ol>
                    <p>
                        <a class="footnote-backref" href="#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text">&#8617;</a>
                    </p>
                </li>
            </ol>
        </div>
    </body>
</html>

Each <li> element in footnote is closed after the first line, while it should be closed only before the beginning of the next <li>.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.extensionRelated to one or more of the included extensions.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions