HarryChen0506 / react-markdown-editor-lite

a light-weight Markdown editor based on React. 一款轻量的基于React的markdown编辑器
https://harrychen0506.github.io/react-markdown-editor-lite/
MIT License
1.02k stars 161 forks source link

Table is not working #260

Open ps0002 opened 2 years ago

ps0002 commented 2 years ago

Subject of the issue Markdown tables aren't rendered correctly. The markdown code is rendered without any formatting. It was working before, After upgrading some of the UI-libs, table doesn't render properly.

My Environment:

"dependencies": { "@blackbox-vision/ra-language-spanish": "~3.5.0", "@material-ui/core": "~4.9.3", "@material-ui/lab": "~4.0.0-alpha.45", "@rehooks/local-storage": "~2.4.0", "final-form-calculate": "~1.3.2", "focus-trap-react": "~6.0.0", "jsencrypt": "~3.0.0-rc.1", "ra-i18n-polyglot": "~3.6.2", "ra-language-english": "~3.6.2", "ra-language-french": "~3.6.2", "ra-language-italian": "~3.0.0", "react-admin": "~3.10.3", "react-dnd": "~10.0.2", "react-dnd-html5-backend": "~10.0.2", "remark-parse": "~9.0.0", "remark-react": "~7.0.1", "remove-markdown": "~0.3.0", "slugify": "~1.4.4", "swagger-ui-react": "~3.27.0", "unified": "~8.4.2", "react-markdown-editor-lite": "~1.0.2", }, "peerDependencies": { "react": ">=16.8.0", "react-dom": ">=16.8.0" }, "devDependencies": { "@testing-library/jest-dom": "~5.11.4", "@testing-library/react": "~11.0.0", "@testing-library/user-event": "~12.1.6", "fetch-mock": "~9.10.3", "identity-obj-proxy": "~3.0.0", "jest-environment-jsdom-sixteen": "~1.0.3", "jest-localstorage-mock": "~2.4.2", "kcd-scripts": "6.3.0", "layer7-apihub-mock": "~1.0.0", "react": ">=16.8.0", "react-dom": ">=16.8.0", "react-scripts": "~4.0.1", "rimraf": "~3.0.2", "typescript": "~4.1.2", "recompose":"~0.30.0" },

Actual Behaviour :

Screen Shot 2022-05-09 at 5 04 22 PM
Tasin5541 commented 2 years ago

Did you find any fix? @ps0002

Judert commented 2 years ago

How do you expect a table without remark-gfm or am I misunderstanding?

Tasin5541 commented 2 years ago

How do you expect a table without remark-gfm or am I misunderstanding?

The demo doesn't use it. There's no mention of it in the readme. Although I'm using it since my last comment with the latest version of react-markdown. (Demo uses version 4+ I think, latest is 8+)

Judert commented 2 years ago

The demo doesn't use react-markdown as far as I can remember, the one they were using had tables baked in. Is the issue fixed now?

Judert commented 2 years ago

Regardless I don't see how parsing issues is react-markdown-editor-lites issue.

Tasin5541 commented 2 years ago

The demo doesn't use react-markdown as far as I can remember, the one they were using had tables baked in. Is the issue fixed now?

This is the one I'm talking about. This uses react-markdown without gfm.

Tasin5541 commented 2 years ago

Regardless I don't see how parsing issues is react-markdown-editor-lites issue.

It's not. But for someone who's working on markdown editor for the first time (like me), it seems like this library would do all the things that I can see on their demo. Would be beginner friendly if there was some mention of the libraries needed for table (gfm) and html (rehype) support.

Judert commented 2 years ago

Oh I see, glad to hear you got it working though 👌

ps0002 commented 1 year ago

Sorry for the late reply. I updated the remark-parse version from 7.1.2 to 9.0.0 to fix this issue. (All versions of package trim lower than 0.0.3 are vulnerable to Regular Expression Denial of Service (ReDoS) via trim().) https://github.com/elastic/eui/issues/5543. However When I upgrade the library, table is not rendered properly. it is broken.