Skip to content

Account for Etree Elements in HTML Stash - #1042

Merged
waylan merged 1 commit into
Python-Markdown:masterfrom
waylan:1040
Oct 14, 2020
Merged

waylan merged 1 commit into
Python-Markdown:masterfrom
waylan:1040

Conversation

@waylan

@waylan waylan commented Oct 14, 2020

Copy link
Copy Markdown
Member

By calling str on all stash elements we ensure they don't raise an error.
Worse case, something like <Element 'div' at 0x000001B2DAE94900> gets
inserted into the output. However, with the override in the md_in_html
extension, we actually serialize and reinsert the original HTML. Worse case,
an HTML block which should be parsed as Markdown gets skipped by the
extension (<div markdown="block"></div> gets inserting into the output).

The tricky part is testing as there should be no known cases where this
ever occurs. Therefore, we forcefully pass an etree Element directly to
the method in the test. That said, as #1040 is unresolved at this point,
I have tested locally with a real existing case and it works well.

Related to #1040.

By calling str on all stash elements we ensure they don't raise an error.
Worse case, soemthing like `<Element 'div' at 0x000001B2DAE94900>` gets
inserted into the output. However, with the override in the md_in_html
extension, we actually serialize and reinsert the original HTML. Worse case,
an HTML block which should be parsed as Markdown gets skipped by the
extension (`<div markdown="block"></div>` gets inserting into the output).

The tricky part is testing as there should be no known cases where this
ever occurs. Therefore, we forefully pass an etree Element directly to
the method in the test. That said, as Python-Markdown#1040 is unresolved at this point,
I have tested locally with a real existing case and it works well.

Related to Python-Markdown#1040.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant