Add a comment explaining why we regex the markdown output

This commit is contained in:
Kovid Goyal 2023-04-24 22:42:00 +05:30
parent 8d6b2750b8
commit cfe2ff3c4b
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -135,6 +135,8 @@ def markdown(val):
from calibre.ebooks.markdown import Markdown from calibre.ebooks.markdown import Markdown
md = markdown.Markdown = Markdown() md = markdown.Markdown = Markdown()
val = md.convert(val) val = md.convert(val)
# The Qt Rich text widgets display <p><br></p> as two blank lines instead
# of one so fix that here.
return re.sub(r'<p(|\s+[^>]*?)>\s*<br\s*/?>\s*</p>','<p\\1>\xa0</p>', val) return re.sub(r'<p(|\s+[^>]*?)>\s*<br\s*/?>\s*</p>','<p\\1>\xa0</p>', val)