The following example renders incorrectly:
import markdown text = ''' He replied, "She said 'Hello.'" ''' html = markdown.markdown(text, extensions=['smarty']) print(html)
The output is:
<p>He replied, “She said ‘Hello.’“</p>
The “
at the end of this example should be ”
.
The quote marks were replaced in this order:
Unfortunately:
"
is not followed by a space (it's the last character of the string, which is stripped prior to replacement).SubstituteTextPattern.handleMatch()
contains \u0003
before the "
).One possible way to fix this issue might be to change closingDoubleQuotesRegex to r'"(?=\s|$)'
(i.e., double quote followed by whitespace or end of string). However that doesn't work in general, so a special case is likely needed.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4