-
Notifications
You must be signed in to change notification settings - Fork 875
PI (<? ?>) is escaped in error with md_in_html #1070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I just remembered that the workaround for no support for markdown/markdown/extensions/md_in_html.py Lines 200 to 210 in 81cc5b8
However, for some reason, |
Yes, this is a little bit of why I had a little bit of trouble jumping into the parser. I assumed that things were always going down the appropriate path, but there appear to be some cases, like this, where things don't seem to get handled properly. Now, I went down the wrong path and tried to cover for this by injecting code that caused other issues instead of getting to the root. While much easier to debug than the old parser, it is still not without some tricky places. |
markdown/markdown/htmlparser.py Lines 34 to 35 in 81cc5b8
It took a while, but I finally remembered that we modified the piclose regex to only match And, as PHP requires that it be closed with In other words, all my example cases here are invalid. With the proper closing (
|
Empty tags do not have a `mardkown` attribute set on them. Therefore, there is no need to check the mdstack to determine behavior. If we are in any md_in_html state (regardless of block, span, etc) the behavior is the same. Fixes Python-Markdown#1070.
Empty tags do not have a `mardkown` attribute set on them. Therefore, there is no need to check the mdstack to determine behavior. If we are in any md_in_html state (regardless of block, span, etc) the behavior is the same. Fixes #1070.
In any of the following source documents:
We get the same output:
Which is correct except for the fact the the opening and closing brackets of the processing instruction (PI) are escaped. We should be getting:
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 (totreebuilder.data
). Upon serialization, it is escaped. The obvious fix would be to pass the content of the PI totreebuilder.pi
, except that xml.etree.ElementTree.TreeBuilder.pi was only added in PY3.8. What do we do for PY3.6 and PY3.7?The text was updated successfully, but these errors were encountered: