Skip to content

fix: keep raw html and decode named entities in markdown files - #4025

Merged
JammingBen merged 2 commits into
mainfrom
fix/md-raw-html-roundtrip
Oct 28, 2026
Merged

JammingBen merged 2 commits into
mainfrom
fix/md-raw-html-roundtrip

Conversation

@JammingBen

@JammingBen JammingBen commented Oct 26, 2026 •

Copy link
Copy Markdown
Member

Description

Raw HTML in markdown files was lost on save. Tiptap parsed it through the editor schema, so unknown tags kept only their text and comments disappeared.

  • Keep raw HTML: the markdown editor now keeps raw HTML as source text and saves it unchanged.
    • Blocks (e.g. <div align="center">, <details>, comments) become an htmlBlock node. It looks like a code block with an "HTML" label.
    • Inline tags (e.g. <kbd>, <sup>, inline comments) become an htmlInline mark, so surrounding formatting stays intact.
    • The editor's own output still goes through the schema as before: resized <img> tags and <br> hard breaks.
  • Decode named entities: named HTML entities (e.g. &copy;, &nbsp;) are now decoded. Before, they were shown literally and escaped again on save.
  • Viewers: read-only viewers (TextEditorViewer) use the new renderHtml option. They still render HTML through the schema instead of showing its source.

Known limitations

#4026

@JammingBen JammingBen self-assigned this Oct 26, 2026

@kulmann kulmann left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explorative testing was fine and code looks good. One UX nit: let keyboard users exit the html block via Shift+Enter and triple-Enter like in our code block.

@JammingBen
JammingBen enabled auto-merge October 28, 2026 10:19
@JammingBen
JammingBen merged commit a0516ba into main Oct 28, 2026
28 checks passed
@JammingBen
JammingBen deleted the fix/md-raw-html-roundtrip branch October 28, 2026 12:11
@openclouders openclouders mentioned this pull request Nov 2, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants