Skip to content

fix(core/markdown): skip entity unescaping for data-include content#5288

Draft
marcoscaceres wants to merge 1 commit into
mainfrom
fix/4096-markdown-entity-escape
Draft

fix(core/markdown): skip entity unescaping for data-include content#5288
marcoscaceres wants to merge 1 commit into
mainfrom
fix/4096-markdown-entity-escape

Conversation

@marcoscaceres
Copy link
Copy Markdown
Contributor

Partially addresses #4096

Skip the &/> entity replacement in markdownToHtml when the
text comes from a raw fetch (data-include) rather than innerHTML.

markdownToHtml() unconditionally replaced & with & and > with >,
assuming input always comes from innerHTML (where the browser
re-serializes entities). For data-include fetched text, this caused
double-escaping: authors had to write & to get & in output.

Add a fromHTML option (default true for backward compat) that skips
the replacement when the text comes from a raw fetch.

Partially addresses #4096
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