-
-
Notifications
You must be signed in to change notification settings - Fork 253
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
Nested HTML inside block_html is escaped when escape=False, parse_block_html=True #81
Comments
Actually, parse_html_block=True and escape=False is a wrong combination. |
Could you explain more about how is that a wrong combination? I need exactly that, use markdown in HTML block, possibly nested, but it only works for not nested HTML blocks. Another example (markdown inside table cell is interpreted correctly (
|
@tdivis try the latest code. |
My examples work fine now, thanks :-). But I'm afraid, that this change broke some escaping elsewhere as these tests will fail:
|
@lepture, could you elaborate on why that combination is wrong? I believe this issue is related to a problem in Jupyter/nbconvert, where html tags inside markdown cells are not properly parsed. Here's the issue: jupyter/nbconvert#328 |
@teoguso my mistake. It should be fixed on the master branch. |
@lepture thanks for the quick reply. I tested the latest master and the nbconvert issue is still there. My temporary solution is to downgrade to version 0.7.2. I'm sorry I can't be more helpful. |
@teoguso could you add a minimized test case for your issue? |
@lepture Let me know if this helps: https://github.com/teoguso/nbconvert-mistune-test |
@teoguso I think your issue is due to commit 2a33458, which changed the regexp of mistune to parse HTML attributes. Namely, the new regexp in mistune 0.7.3 does not match anymore quote-less HTML attributes, whereas the old regexp did. Therefore, any HTML code with a quote-less (single or double quote) gets recognized as For instance: Workaround: systematically put quotes in HTML attributes, even if it is not mandatory according to the W3C standards. @lepture You might want to change line 38 of mistune.py for, e.g.: |
@deroulers Thanks. Here is the fix: f7b5239 |
@lepture @deroulers thanks! I confirm that the latest master now works without having to use quotes. Do we have to wait for 0.7.4 to get it on pip/conda by default? Cheers! |
I am having an ongoing issue, similar to @teoguso, with tags in jupyter/nbconvert even with mistune 0.74. If there are spaces around the equals sign for the HTML attribute, the tag is not parsed. I assume this is related to the quotation mark issue. |
@danzimmerman I think standard HTML does not support spaces around the equal sign. This is not a bug I believe. |
@teoguso @lepture It actually does, even if it's a bad practice. So, right now it is not following the HTML5 spec:
source(emphasis mine) The same restrictions & allowances (more or less) also apply to single quoted and double quoted values. NB: There is this SO post on why it might be bad practice. |
@mpacer I see. Thanks, that's good to know! I guess the HTML landscape can be a bit messy... |
Fixed in 0.8.4 |
Normally with
escape=False
, nested HTML block is corectly not escaped:But when I add
parse_block_html=True
, only out-most element is not escaped and the rest is escaped:The text was updated successfully, but these errors were encountered: