Skip to content

PI (<? ?>) is escaped in error with md_in_html #1070

Description

@waylan

In any of the following source documents:

<div markdown=1>

<?php print("foo"); >

</div>
<div markdown=1>
<?php print("foo"); >
</div>
<div markdown=1><?php print("foo"); ></div>

We get the same output:

<div>
<p>&lt;?php print("foo"); &gt;</p>
</div>

Which is correct except for the fact the the opening and closing brackets of the processing instruction (PI) are escaped. We should be getting:

<div>
<p><?php print("foo"); ></p>
</div>

The problem is related to the fact that the extension builds an etree object of raw HTML when markdown=1. However, the PI (<?php print("foo"); >) is simply passed to the etree object as text data (to treebuilder.data). Upon serialization, it is escaped. The obvious fix would be to pass the content of the PI to treebuilder.pi, except that xml.etree.ElementTree.TreeBuilder.pi was only added in PY3.8. What do we do for PY3.6 and PY3.7?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBug report.confirmedConfirmed bug report or approved feature request.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