markdown-to-jsx icon indicating copy to clipboard operation
markdown-to-jsx copied to clipboard

Bug: HTML in Tables lead to Crash with >v6.10.2

Open sirtobey opened this issue 2 years ago • 0 comments

Steps to reproduce

  • install Markdown-to-JSX with Version greater than v6.10.2
  • Render HTML tags inside a markdown table:
import React from "react";
import Markdown from "markdown-to-jsx";

export default function App() {
  return (
    <Markdown
      children={`|     | Header 1 | Header 2 |
      | --- | ---------| ---------------- |
      | 1   | Title | |
      | 2   | Title 2 | |
      | 3   | Title 3 | |
      | 4   | Title 4 | <ul><li>text 15</li><li>text 16</li><li>text 17</li></ul>                                                                       |
      `}
    ></Markdown>
  );
}

Source by dimensi

Current behaviour (bug) Rendering crashes with Internal Error - too much recursion in Firefox, slows down Chrome without rendering.

Expected behaviour (correct) Render Table with HTML elements.

Relevant logs and/or media

  • See @dimensi Issue https://github.com/probablyup/markdown-to-jsx/issues/396

Other comments

  • Issue might be at https://github.com/probablyup/markdown-to-jsx/blob/main/index.tsx#L716 https://github.com/probablyup/markdown-to-jsx/blob/main/index.tsx#L655 unverified
  • Disabling HTML inside Markdown is not an option for my company at the time. But for security concerns we wanted to upgrade, which lead to our SSR nodes crashing on a regular basis.
  • Reported by @dimensi, maybe others

Let me know if I can provide any additional info or guide me how we could fix this issue. Thank you!

sirtobey avatar Mar 31 '22 13:03 sirtobey