Repository navigation
Keep paragraph text in saved Markdown and in the newsletter text part - #1
Merged
Merged
Conversation
The image-card extension holds the paragraph Markdown token, so @tiptap/markdown also asked it how to write paragraphs. It had no writer, so every paragraph (and every list item and table cell) saved as an empty string in the post's Markdown copy. The newsletter's text/plain part is built from that copy, so posts saved from the editor mailed a text part with headings and image alt text only. - MarkdownImages writes paragraphs the way the paragraph extension does. - The newsletter text part falls back to the HTML body when the Markdown copy holds clearly fewer words, so posts saved before this fix send their full text. - plainBody writes HTML lists and tables as one line per item and per row. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What broke
MarkdownImages(the extension that opens Markdown images as image cards) registers under theparagraphMarkdown token so its parser runs first.@tiptap/markdownlooks up a node's writer through the parse registry first too, so it askedMarkdownImageshow to write paragraphs. It had norenderMarkdown, so every paragraph, list item and table cell saved as an empty string in the post's Markdown copy.The newsletter's text/plain part is built from that copy (
plainBody(post.markdown)), so a post saved from the editor mailed a text part with only headings, image alt text and empty bullets, next to a full HTML part.Fix
MarkdownImages.renderMarkdownwrites paragraphs the way the paragraph extension does (children, and for a second empty paragraph in a row).newsletterEmailbuilds the text part from the Markdown copy only when it holds at least 80% of the HTML body's words; otherwise from the HTML body. Posts saved before this fix send their full text without a re-save.plainBodywrites HTML lists as- itemlines and tables as onea | bline per row, with blank lines between blocks.Checked
bun run typecheck, admin build, leak guard.🤖 Generated with Claude Code