小编cla*_*uin的帖子

ReactMarkdown + remarkGfm:一切都按预期呈现,除了表格 - typeError?

我正在测试 ReactMarkdown 以便能够从 chatgpt 生成的 Markdown 语法渲染 HTML 表。我已经安装了react-markdown和remarkGfm。但我不断收到此错误: TypeError 无法设置未定义的属性(设置 'inTable')

当isolated + markdown被硬编码用于测试时,我在项目和codesandbox中都收到错误。这是代码:

import ReactMarkdown from 'react-markdown';
import remarkGfm from 'remark-gfm';

const MarkdownResponse = () => {
    const response = `
  # heading 1
  ## heading 2
  ### heading 3
  ~~strikethrough~~  

  > Blockquote  

  **strong**  
  *italics*  
  ***
  [Gmail](https://gmail.com)  
  ***
  1. ordered list
  2. ordered list
  - unordered list
  - unordered list  
  
  | Syntax      | Description |
  | ----------- | ----------- |
  | Header      | Title       |
  | Paragraph   | …
Run Code Online (Sandbox Code Playgroud)

markdown reactjs commonmark react-markdown remarkgfm

9
推荐指数
2
解决办法
2984
查看次数