fix(UI/markdown): markdown not recognized ** as emphasis marks in CJK (#4119)

This commit is contained in:
fullex 2025-03-29 23:56:41 +08:00 committed by GitHub
parent d6e66f3a4d
commit 7e67005e70
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 53 additions and 2 deletions

View File

@ -166,6 +166,7 @@
"rehype-katex": "^7.0.1", "rehype-katex": "^7.0.1",
"rehype-mathjax": "^7.0.0", "rehype-mathjax": "^7.0.0",
"rehype-raw": "^7.0.0", "rehype-raw": "^7.0.0",
"remark-cjk-friendly": "^1.1.0",
"remark-gfm": "^4.0.0", "remark-gfm": "^4.0.0",
"remark-math": "^6.0.0", "remark-math": "^6.0.0",
"rollup-plugin-visualizer": "^5.12.0", "rollup-plugin-visualizer": "^5.12.0",

View File

@ -14,6 +14,7 @@ import rehypeKatex from 'rehype-katex'
// @ts-ignore next-line // @ts-ignore next-line
import rehypeMathjax from 'rehype-mathjax' import rehypeMathjax from 'rehype-mathjax'
import rehypeRaw from 'rehype-raw' import rehypeRaw from 'rehype-raw'
import remarkCjkFriendly from 'remark-cjk-friendly'
import remarkGfm from 'remark-gfm' import remarkGfm from 'remark-gfm'
import remarkMath from 'remark-math' import remarkMath from 'remark-math'
@ -80,7 +81,7 @@ const Markdown: FC<Props> = ({ message, citationsData }) => {
return ( return (
<ReactMarkdown <ReactMarkdown
rehypePlugins={rehypePlugins} rehypePlugins={rehypePlugins}
remarkPlugins={[remarkMath, remarkGfm]} remarkPlugins={[remarkMath, remarkGfm, remarkCjkFriendly]}
className="markdown" className="markdown"
components={components()} components={components()}
disallowedElements={['iframe']} disallowedElements={['iframe']}

View File

@ -3848,6 +3848,7 @@ __metadata:
rehype-katex: "npm:^7.0.1" rehype-katex: "npm:^7.0.1"
rehype-mathjax: "npm:^7.0.0" rehype-mathjax: "npm:^7.0.0"
rehype-raw: "npm:^7.0.0" rehype-raw: "npm:^7.0.0"
remark-cjk-friendly: "npm:^1.1.0"
remark-gfm: "npm:^4.0.0" remark-gfm: "npm:^4.0.0"
remark-math: "npm:^6.0.0" remark-math: "npm:^6.0.0"
rollup-plugin-visualizer: "npm:^5.12.0" rollup-plugin-visualizer: "npm:^5.12.0"
@ -7778,7 +7779,7 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"get-east-asian-width@npm:^1.0.0": "get-east-asian-width@npm:^1.0.0, get-east-asian-width@npm:^1.3.0":
version: 1.3.0 version: 1.3.0
resolution: "get-east-asian-width@npm:1.3.0" resolution: "get-east-asian-width@npm:1.3.0"
checksum: 10c0/1a049ba697e0f9a4d5514c4623781c5246982bdb61082da6b5ae6c33d838e52ce6726407df285cdbb27ec1908b333cf2820989bd3e986e37bb20979437fdf34b checksum: 10c0/1a049ba697e0f9a4d5514c4623781c5246982bdb61082da6b5ae6c33d838e52ce6726407df285cdbb27ec1908b333cf2820989bd3e986e37bb20979437fdf34b
@ -10397,6 +10398,39 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"micromark-extension-cjk-friendly-util@npm:^1.1.0":
version: 1.1.0
resolution: "micromark-extension-cjk-friendly-util@npm:1.1.0"
dependencies:
get-east-asian-width: "npm:^1.3.0"
micromark-util-character: "npm:^2.0.0"
micromark-util-symbol: "npm:^2.0.0"
peerDependenciesMeta:
micromark-util-types:
optional: true
checksum: 10c0/3ae1d4fd92f03a6c8e34e314c14a42b35cdd1bcbe043fceb1d2d45cd1a7b364e77643a3ca181910666cb11cc3606a1595fae9a15e87b0a4988fc57d5e4f65f67
languageName: node
linkType: hard
"micromark-extension-cjk-friendly@npm:^1.1.0":
version: 1.1.0
resolution: "micromark-extension-cjk-friendly@npm:1.1.0"
dependencies:
devlop: "npm:^1.0.0"
micromark-extension-cjk-friendly-util: "npm:^1.1.0"
micromark-util-chunked: "npm:^2.0.0"
micromark-util-resolve-all: "npm:^2.0.0"
micromark-util-symbol: "npm:^2.0.0"
peerDependencies:
micromark: ^4.0.0
micromark-util-types: ^2.0.0
peerDependenciesMeta:
micromark-util-types:
optional: true
checksum: 10c0/95be6d8b4164b9b3b5281d77ed4f9337d95b2041ad4f7a775baa0d7f8ec495818101881eea2c7cc0ee4ee11738716899f20b3fbfbc2e6b80106544065d2ec04d
languageName: node
linkType: hard
"micromark-extension-gfm-autolink-literal@npm:^2.0.0": "micromark-extension-gfm-autolink-literal@npm:^2.0.0":
version: 2.1.0 version: 2.1.0
resolution: "micromark-extension-gfm-autolink-literal@npm:2.1.0" resolution: "micromark-extension-gfm-autolink-literal@npm:2.1.0"
@ -13665,6 +13699,21 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"remark-cjk-friendly@npm:^1.1.0":
version: 1.1.0
resolution: "remark-cjk-friendly@npm:1.1.0"
dependencies:
micromark-extension-cjk-friendly: "npm:^1.1.0"
peerDependencies:
"@types/mdast": ^4.0.0
unified: ^11.0.0
peerDependenciesMeta:
"@types/mdast":
optional: true
checksum: 10c0/ef43a4c404baaaa3e3d888ea68db8ffa101746faadb96d19d6b7ee8d00f0a025613c2e508527236961b226e41d8fb34f6cc6ac217ae8770fcbf47b9f496ab32a
languageName: node
linkType: hard
"remark-gfm@npm:^1.0.0": "remark-gfm@npm:^1.0.0":
version: 1.0.0 version: 1.0.0
resolution: "remark-gfm@npm:1.0.0" resolution: "remark-gfm@npm:1.0.0"