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
The code contains wrong escapes, and I hope to get merge_md_files.
It is because that markdownify only check the parent name in process_text:
defprocess_text(self, el):
text=six.text_type(el) or''# dont remove any whitespace when handling pre or code in preifnot (el.parent.name=='pre'or (el.parent.name=='code'andel.parent.parent.name=='pre')):
text=whitespace_re.sub(' ', text)
ifel.parent.name!='code'andel.parent.name!='pre':
text=self.escape(text)
# remove trailing whitespaces if any of the following condition is true:# - current text node is the last node in li# - current text node is followed by an embedded listif (el.parent.name=='li'and (notel.next_siblingorel.next_sibling.namein ['ul', 'ol'])):
text=text.rstrip()
returntext
I monkey patched the code like:
defprocess_text(self: markdownify.MarkdownConverter, el):
text=six.text_type(el) or''# dont remove any whitespace when handling pre or code in preifnot (el.parent.name=='pre'or (el.parent.name=='code'andel.parent.parent.name=='pre')):
text=markdownify.whitespace_re.sub(' ', text)
cursor=elis_code=Falsewhilecursor.name!='[document]':
ifcursor.namein ('code', 'pre'):
is_code=Truecursor=cursor.parentifnotis_code:
text=self.escape(text)
# remove trailing whitespaces if any of the following condition is true:# - current text node is the last node in li# - current text node is followed by an embedded listif (el.parent.name=='li'and (notel.next_siblingorel.next_sibling.namein ['ul', 'ol'])):
text=text.rstrip()
returntextmarkdownify.MarkdownConverter.process_text=process_text
Now it works well.
And if my suggestion is useful, I can post a PR.
The text was updated successfully, but these errors were encountered:
I would like to reach an active maintainer of this project, as there are several fixes I would like to contribute (and more tests I would like to add).
Here's a typical hljs rendered html format.
The code contains wrong escapes, and I hope to get
merge_md_files
.It is because that markdownify only check the parent name in
process_text
:I monkey patched the code like:
Now it works well.
And if my suggestion is useful, I can post a PR.
The text was updated successfully, but these errors were encountered: