Skip to content

md_in_html can process content out of order if block HTML is nested under it #1502

Closed
@facelessuser

Description

@facelessuser

I have Block plugins that expect a start /// start and end ///. In almost all cases, it seems it is a reasonable assumption that Python Markdown will process the start before the end allowing the plugin to work.

In a case like below, this holds true. I add some logging to show when the processed lines are encountered.

/// 1

<p>
Hello i'm a 'p' in a tab which in in a div!
</p>

/// 2

Order logged:

/// 1
/// 2

A problem is introduced though when md_in_html is used.

<div class="my-div" markdown>

/// 1

<p>
Hello i'm a 'p' in a tab which in in a div!
</p>

/// 2

</div>

Order logged:

/// 2
/// 1

As we can see the order of processing is now out of order, and since our extension relies on this order, the extension also breaks.

If the wrapping tag is inline, there is no problem. If the nested tag is inline, there is also no problem. So this is only when block tags are used within a block tag being processed by md_in_html.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions