diff --git a/web/package.json b/web/package.json index 3fdc6889b..c4304d236 100644 --- a/web/package.json +++ b/web/package.json @@ -37,7 +37,7 @@ "react-icons": "^4.12.0", "react-markdown": "^9.0.1", "react-toastify": "^9.1.3", - "rehype-highlight": "^6.0.0", + "rehype-highlight": "^7.0.1", "rehype-highlight-code-lines": "^1.0.4", "rehype-katex": "^7.0.1", "rehype-raw": "^7.0.0", diff --git a/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx b/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx index 5df69966f..61a26e60d 100644 --- a/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx +++ b/web/screens/Thread/ThreadCenterPanel/SimpleTextMessage/index.tsx @@ -95,7 +95,6 @@ const SimpleTextMessage: React.FC = (props) => { // Join the lines with newline characters for proper formatting return codeLines.join('\n') } - function wrapCodeBlocksWithoutVisit() { return (tree: { children: any[] }) => { tree.children = tree.children.map((node) => { @@ -395,12 +394,7 @@ const SimpleTextMessage: React.FC = (props) => { rehypePlugins={[ [rehypeKatex, { throwOnError: false }], rehypeRaw, - [ - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - rehypeHighlight, - { subset: false, plainText: ['txt', 'text'] }, - ], + rehypeHighlight, [rehypeHighlightCodeLines, { showLineNumbers: true }], wrapCodeBlocksWithoutVisit, ]}