mdx-editor / mdx-editor/editor
[BUG] HTML tables get linebreaks added between rows
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 307
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 5
Description
If you're unlucky enough to have an HTML table in your content, the editor adds line breaks to it between sections, which are then converted to implicit <p>s by the MDX renderer, which breaks table display.
- I have searched for similar issues in both open and closed tickets and cannot find a duplicate.
- I have read the documentation and cannot find an answer.
Describe the bug
Loading <table> content gets line breaks added in (visible in the diff viewer), which are then turned into ps when the MDX is rendered.
Reproduction
https://codesandbox.io/p/sandbox/mdx-editor-base-forked-y5mryt
To Reproduce
Steps to reproduce the behavior:
View the sandbox, switch to Diff mode to see the extra line breaks
Expected behavior
The <table> HTML should be left undisturbed
Desktop (please complete the following information):
Operating System:
Platform: darwin
Arch: x64
Version: Darwin Kernel Version 22.6.0: Fri Sep 15 13:39:52 PDT 2023; root:xnu-8796.141.3.700.8~1/RELEASE_X86_64
Binaries:
Node: 20.10.0
npm: 10.2.3
Relevant Packages:
next: 14.0.4
eslint-config-next: 14.0.4
react: 18.2.0
react-dom: 18.2.0
typescript: 5.3.3
Chrome 119
mdx-editor: 2.3.4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked CodeSandbox reproduction and switch to Diff mode to observe the extra line breaks between HTML table sections. Trace the editor's handling of the table content, then verify that table HTML remains undisturbed and does not render implicit paragraphs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100