diff --git a/package.json b/package.json index 01fbb8bce2..f225b4c8cd 100644 --- a/package.json +++ b/package.json @@ -243,6 +243,7 @@ "rehype-raw": "^7.0.0", "remark-cjk-friendly": "^1.2.0", "remark-gfm": "^4.0.1", + "remark-github-blockquote-alert": "^2.0.0", "remark-math": "^6.0.0", "remove-markdown": "^0.6.2", "rollup-plugin-visualizer": "^5.12.0", diff --git a/src/renderer/src/assets/styles/markdown.scss b/src/renderer/src/assets/styles/markdown.scss index e861af3618..6bd29fc8ac 100644 --- a/src/renderer/src/assets/styles/markdown.scss +++ b/src/renderer/src/assets/styles/markdown.scss @@ -148,6 +148,7 @@ margin-top: 10px; } + .markdown-alert, blockquote { margin: 1.5em 0; padding: 1em 1.5em; diff --git a/src/renderer/src/pages/home/Markdown/Markdown.tsx b/src/renderer/src/pages/home/Markdown/Markdown.tsx index 348b6fb05f..0e3d0ef580 100644 --- a/src/renderer/src/pages/home/Markdown/Markdown.tsx +++ b/src/renderer/src/pages/home/Markdown/Markdown.tsx @@ -1,6 +1,7 @@ import 'katex/dist/katex.min.css' import 'katex/dist/contrib/copy-tex' import 'katex/dist/contrib/mhchem' +import 'remark-github-blockquote-alert/alert.css' import ImageViewer from '@renderer/components/ImageViewer' import MarkdownShadowDOMRenderer from '@renderer/components/MarkdownShadowDOMRenderer' @@ -22,6 +23,7 @@ import rehypeMathjax from 'rehype-mathjax' import rehypeRaw from 'rehype-raw' import remarkCjkFriendly from 'remark-cjk-friendly' import remarkGfm from 'remark-gfm' +import remarkAlert from 'remark-github-blockquote-alert' import remarkMath from 'remark-math' import { Pluggable } from 'unified' @@ -90,6 +92,7 @@ const Markdown: FC = ({ block, postProcess }) => { const remarkPlugins = useMemo(() => { const plugins = [ [remarkGfm, { singleTilde: false }] as Pluggable, + [remarkAlert] as Pluggable, remarkCjkFriendly, remarkDisableConstructs(['codeIndented']) ] diff --git a/yarn.lock b/yarn.lock index db358df78d..0db62de230 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7814,6 +7814,7 @@ __metadata: rehype-raw: "npm:^7.0.0" remark-cjk-friendly: "npm:^1.2.0" remark-gfm: "npm:^4.0.1" + remark-github-blockquote-alert: "npm:^2.0.0" remark-math: "npm:^6.0.0" remove-markdown: "npm:^0.6.2" rollup-plugin-visualizer: "npm:^5.12.0" @@ -18702,6 +18703,15 @@ __metadata: languageName: node linkType: hard +"remark-github-blockquote-alert@npm:^2.0.0": + version: 2.0.0 + resolution: "remark-github-blockquote-alert@npm:2.0.0" + dependencies: + unist-util-visit: "npm:^5.0.0" + checksum: 10c0/7a84d5889b94ee2b7feba6b6d41d4b08025b38d752cfb8de2cd216ed61b768db7f706ef9d76eb484ce98b72b01a3005c0b2e08231d07d7cffe4538f91ca25dde + languageName: node + linkType: hard + "remark-math@npm:^4.0.0": version: 4.0.0 resolution: "remark-math@npm:4.0.0"