You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that in some scenarios, this bug can occur:
Suppose your string is the following:
>>> string = """
... Start of test.
...
... for (i=0; i<3; i++) {
... printf("Hello, world.");
... }
...
... > This is a quote
...
... End of test.
... """
I would expect the C-code snippet to be formatted as a code block, and the quote to be formatted as a blockquote.
However, when I use safe_mode="escape" (because I want users of this to be able to use HTML in the application), markdown2 thinks that there is a big HTML tag in this block from the less than symbol to the beginning of the blockquote:
>>> import markdown2
>>> markdown2.markdown(string, safe_mode="escape")
'<p>Start of test.</p>\n\n<pre><code>for (i=0; i<3; i++) {\n printf("Hello, world.");\n } \n\n> This is a quote\n</code></pre>\n\n<p>End of test.</p>\n'
>>> markdown2.markdown(string, safe_mode="replace")
'<p>Start of test.</p>\n\n<pre><code>for (i=0; i[HTML_REMOVED] This is a quote\n</code></pre>\n\n<p>End of test.</p>\n'
>>>
This seems to be a bug, because it means I cannot have a blockquote after a block of code that uses a < symbol.
Activity
nicholasserra commentedon Feb 1, 2017
Did you try this on the latest commit? We had a bug around escaping that may have effected this.
gregschmit commentedon Feb 1, 2017
I did, and the code block is extended to include the blockquote. You can try it if you want. I guess I didn't give a clear way of replicating:
string = """, and then paste the following text into it:Then you should see that the code block extends all the way through the quote, when it should end before the "This is a sentence".