Skip to content

fix: keep image embeds in markdown when saving - #4340

Merged
JammingBen merged 1 commit into
mainfrom
fix/markdown-image-embeds
Nov 6, 2026
Merged

JammingBen merged 1 commit into
mainfrom
fix/markdown-image-embeds

Conversation

@JammingBen

Copy link
Copy Markdown
Member

Description

Saving a Markdown file in the text editor deleted every image embed that was not alone in its paragraph, together with the table cell or paragraph (text included) around it.

Tiptap creates schema-invalid content for such images (ueberdosis/tiptap#8714), and the Yjs binding drops the invalid nodes.

  • Images in the Markdown editor are now inline, as they are in Markdown. A lone image stays wrapped in its paragraph. This workaround is marked with a FIXME and can go once the tiptap issue is fixed.
  • Resized images are saved as <img>. One that starts a paragraph with more lines, e.g. before a hard break, is now read back as a paragraph, in the editor and in the read-only viewer. Hand-written HTML blocks stay unchanged.
  • An unsized hand-written <img> next to text stays raw HTML, so it isn't rewritten as broken Markdown, e.g. for a source with a space in it.
  • Images can no longer be inserted into code-like blocks (code, frontmatter, raw HTML), where an inline image would split the block. Toolbar and slash command image actions are disabled there.
  • Several images dropped or pasted at once keep their order.

Related Issue

@JammingBen JammingBen self-assigned this Nov 6, 2026
@JammingBen
JammingBen marked this pull request as ready for review November 6, 2026 12:28
@JammingBen
JammingBen merged commit a76e5c5 into main Nov 6, 2026
29 checks passed
@JammingBen
JammingBen deleted the fix/markdown-image-embeds branch November 6, 2026 12:37
@openclouders openclouders mentioned this pull request Nov 6, 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.

text-editor deletes image embeds — and the table cell or paragraph around them — when saving Markdown

2 participants