build(deps): tiptap v3 + unify markdown on marked (drop markdown-it) - #1644
Open
mattwoberts wants to merge 3 commits into
Open
build(deps): tiptap v3 + unify markdown on marked (drop markdown-it)#1644mattwoberts wants to merge 3 commits into
mattwoberts wants to merge 3 commits into
Conversation
First step of unifying the app's two markdown engines onto marked. This upgrades the display renderer (public/services/markdown.ts) off the ancient marked 4 (held by a dependabot ignore) to marked 17 — the version @tiptap/markdown peers, so the later editor migration will dedupe to a single marked copy. marked 5+ is ESM-only and replaced the positional Renderer API with token objects registered via .use(). Changes: - markdown.ts: two Marked instances (full + plain-text) with RendererObject overrides; custom escape keeps apostrophes literal (marked now emits '); fider-image + @[mention] syntaxes preserved byte-identically. - package.json: marked ^4.0.15 -> ^17.0.6; remove @types/marked (marked ships its own types); jest transform now includes .js + transformIgnorePatterns allows transforming marked's ESM. - .babelrc -> babel.config.json: a root babel config is required for jest to transform ESM node_modules (a file-scoped .babelrc does not apply to them). Webpack's babel-loader only processes public/ + locale/, so the build is unaffected. - dependabot.yml: marked now held on 17.x (was 4.x) pending @tiptap/markdown supporting marked 18. Validated byte-identical: markdown.spec.ts (32/32), plus make lint-ui, build-ui, test-ui all green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…0.9) Bumps the whole @tiptap/* stack to 3.29.2 (exact-pinned — tiptap enforces identical versions across its packages), tiptap-markdown -> 0.9.0, moves Placeholder to @tiptap/extensions, disables StarterKit's now-bundled Link + Underline, and sets setContent emitUpdate:false. Adds a byte-identical markdown round-trip test suite (13 cases incl. fider-image + @mention) as the gate for the later @tiptap/markdown engine swap. jest transformIgnorePatterns extended for @tiptap/tiptap-markdown/prosemirror ESM. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
… on marked)
Completes the unify-on-marked migration: the editor now uses first-party
@tiptap/markdown (marked engine) instead of tiptap-markdown (markdown-it).
markdown-it, tiptap-markdown and prosemirror-markdown are removed entirely —
the app now runs a SINGLE markdown engine (marked 17), shared by the editor
and the display renderer.
Custom-node rewrite (markdown-it rules -> @tiptap/markdown hooks):
- CustomImage: markdownTokenName "image" + parseMarkdown/renderMarkdown; detects
. Made the node INLINE — marked tokenizes images as
inline tokens, so a block node was dropped during parse (matches the
fider-inline-image intent).
- CustomMention: a custom marked markdownTokenizer for the non-standard @[name]
syntax + parseMarkdown/renderMarkdown.
- Note: `this` inside parseMarkdown is NOT the extension (no this.name/this.options),
so node types are literals and image src uses the static path (the same fallback
used before; live base64 uploads still flow through the setImage command).
- CommentEditor: Markdown.configure({ markedOptions: { breaks, gfm } }),
content/setContent use contentType:"markdown", getMarkdown().trim() (v3 appends a
trailing empty paragraph).
Validation: new 21-case byte-identical round-trip suite (mentions/images in text,
mixed inline, multi-paragraph, hard breaks, links+mentions) + markdown.spec 32/32
(renderer contract unchanged) + make lint-ui/build-ui/test-ui all green. Hard
breaks normalize to the standard two-space form, which the renderer emits as
identical <br> HTML, so existing stored content is unaffected.
Co-Authored-By: Claude Opus 4.8 (1M context) <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.
The full unify-on-marked migration. Ends with the app running a single markdown engine (marked 17) for both the editor and the display renderer. Three commits:
markdown.ts) rewritten to marked's token API; byte-identical (markdown.spec.ts32/32);.babelrc→babel.config.json+ jest ESM transform.@tiptap/*stack to 3.29.2, StarterKit Link/Underline disabled, Placeholder →@tiptap/extensions,setContentemitUpdate handling.@tiptap/markdown— dropstiptap-markdown,markdown-it, andprosemirror-markdown.What changed in the swap
markdown-it,tiptap-markdown,prosemirror-markdownremoved; only@tiptap/markdown+markedremain (both on marked 17, deduped).parseMarkdown/renderMarkdownfor thesyntax; the node is now inline (marked tokenizes images inline — a block node was silently dropped during parse; also matches thefider-inline-imageintent).markdownTokenizerfor the non-standard@[name]syntax + parse/render hooks.contentType: "markdown"on content/setContent,getMarkdown().trim().Gotchas found & handled
thisinsideparseMarkdownis not the extension (nothis.name/this.options) → node types are literals; imagesrcuses the static path (same fallback as before; live base64 uploads still go through thesetImagecommand).setContentappends a trailing empty paragraph →.trim().<br>HTML for bare\nand\nunderbreaks:true), so existing stored content is unaffected.Validation
CommentEditor.markdown.spec.ts): mentions/images standalone and in text, mixed inline, multi-paragraph, hard breaks, links+mentions.markdown.spec.ts32/32 (renderer contract unchanged),setImagecommand →verified.make lint-ui/build-ui/test-uigreen. CI (incl. e2e) is the next gate.Please review carefully
Images are now inline rather than block — a deliberate change (required for marked parse; matches the inline-image class), but it changes editor layout, so worth a visual check. This is the experimental "how far can we go" branch; the safe fallback is the earlier tiptap-v3-only state.
🤖 Generated with Claude Code