Character reference replacement results in raw HTML
- Vorherrschende Sprache
- Python
- Sterne
- 2.2k
- Forks
- 296
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
As a result of #109, character and entity references are unconditionally dereferenced. This causes HTML which contains character references representing HTML-like text to be converted to markdown with raw HTML by html2text 2017.10.4 and later:
$ echo "
Horizontal rule is <hr>
" | html2markdownHorizontal rule is
To make the problem clearer, consider round-tripping from HTML to Markdown back to HTML:
$ echo "
Horizontal rule is <hr>
" | html2markdown | cmarkHorizontal rule is
$ echo "
Horizontal rule is <hr>
" | html2markdown | cmark --unsafeHorizontal rule is
The conversion to markdown changes the meaning of the content by dereferencing the character references.
To satisfy the request in #109, I suggest preserving character and entity references which would be interpreted as [Raw HTML](https://spec.commonmark.org/0.30/#raw-html) if dereferenced. That would avoid producing unnecessary character references (as requested in #109) and also avoid changing the meaning of the content when it contains HTML-like text.
Thanks for considering,
Kevin
Beitragsleitfaden
Bewertung
Dieses Issue wurde noch nicht bewertet.