-
Notifications
You must be signed in to change notification settings - Fork 16
fix(richtext)!: HTML and Markdown parsing for links and edge cases #369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors HTML and Markdown parsing to use Tiptap's built-in generateJSON command, fixing edge cases with links and nested tags that weren't handled correctly by the previous custom parser.
- Replaced custom HTML parsing logic with Tiptap's
generateJSONfor more robust HTML-to-richtext conversion - Simplified Markdown parser to convert Markdown to HTML first, then use the HTML parser
- Changed the API from custom
resolversto TiptaptipTapExtensionsfor customization
Reviewed Changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/richtext/src/markdown-parser.ts | Simplified to render Markdown as HTML then delegate to HTML parser |
| packages/richtext/src/markdown-parser.test.ts | Updated tests to use Tiptap extensions and reflect new output format |
| packages/richtext/src/html-parser.ts | Complete rewrite using Tiptap's generateJSON with custom extensions |
| packages/richtext/src/html-parser.test.ts | Updated tests for new Tiptap-based implementation |
| packages/richtext/package.json | Added Tiptap dependencies, removed node-html-parser |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Parsing did not work correctly for certain combinations of `<a>` and nested tags inside or around it. To ensure parsing is aligned with the Tiptap editor format, we now use the Tiptap editor's `generateJSON` command, which gives us HTML-to-richtext conversion out of the box. BREAKING CHANGE: Instead of our own resolver format, we now allow users to override the Tiptap extensions used for parsing. Fixes WDX-141
5cdcca2 to
6d45762
Compare
@storyblok/astro
storyblok
@storyblok/eslint-config
@storyblok/js
storyblok-js-client
@storyblok/management-api-client
@storyblok/nuxt
@storyblok/react
@storyblok/region-helper
@storyblok/richtext
@storyblok/svelte
@storyblok/vue
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is being reviewed by Cursor Bugbot
Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
| }, | ||
| ]; | ||
| }, | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Reporter falsely warns on allowed link custom attributes
The Reporter mark warns about unsupported attributes on all elements, including custom attributes on <a> tags. When allowCustomAttributes is enabled, custom attributes on links are intentionally supported via the custom field, but the Reporter has no awareness of this option and incorrectly warns that these attributes cannot be transformed.
Parsing did not work correctly for certain combinations of
<a>and nested tags inside or around it.To ensure parsing is aligned with the Tiptap editor format, we now use the Tiptap editor's
generateJSONcommand, which gives us HTML-to-richtext conversion out of the box.BREAKING CHANGE: Instead of our own resolver format, we now allow users to override the Tiptap extensions used for parsing.
Fixes WDX-141
Note
Migrates richtext HTML/Markdown parsing to Tiptap (with configurable extensions) and updates ecosystem dependencies (Vitest env, React/Vue/Nuxt/Vite) across the repo.
@tiptap/html+ extensions (e.g., link, list, table, image, etc.).node-html-parser,markdown-it-github).happy-domto Vitest setups; align vitest-related deps.Written by Cursor Bugbot for commit 6d45762. This will update automatically on new commits. Configure here.