trentm / trentm/python-markdown2
Angle Brackets Bug
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 2.8k
- Forks
- 459
- Avg merge
- 2d 19h
- Merged PRs (30d)
- 4
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the markdown2.markdown entry point and reproduce the supplied string with safe_mode="escape" and safe_mode="replace". Done means the C-code block preserves the less-than symbol and the following quote is rendered as a separate blockquote in both relevant cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100