Skip to content

Fix double escaping in fenced code previews - #188

Merged
jaywcjlove merged 1 commit into
uiwjs:mainfrom
feritcemkahraman:fix/markdown-fenced-preview
Nov 4, 2026
Merged

jaywcjlove merged 1 commit into
uiwjs:mainfrom
feritcemkahraman:fix/markdown-fenced-preview

Conversation

@feritcemkahraman

Copy link
Copy Markdown
Contributor

Problem

Markdown fenced HTML such as <div /> is displayed as &lt;div /> in the highlighted preview because its contents are escaped twice. Fixes #177.

Change

Escape the source once before parsing the preview. Add regression coverage for fenced HTML and JavaScript, literal entities, and markup escaping with and without the highlighting plugin.

Validation

  • Ran six standalone checks against the actual TypeScript utility, rehype, rehype-prism-plus and jsdom: preview text matches input and HTML is not injected. The fenced HTML case failed before the change and passes after it.
  • The repository Jest suite and the added Jest test were not run: dependency installation did not finish in this environment.

AI assistance: Codex assisted with investigation, implementation and validation.

@jaywcjlove
jaywcjlove merged commit cefb9cc into uiwjs:main Nov 4, 2026
1 check passed
jaywcjlove added a commit that referenced this pull request Nov 4, 2026
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.

Markdown html code blocks break

2 participants