修复单个波浪号被识别为删除线的问题
This commit is contained in:
+3
-1
@@ -2,6 +2,7 @@ import { defineConfig } from 'astro/config';
|
||||
import { unified } from '@astrojs/markdown-remark';
|
||||
import sitemap from '@astrojs/sitemap';
|
||||
import tailwindcss from '@tailwindcss/vite';
|
||||
import remarkGfm from 'remark-gfm';
|
||||
import remarkMath from 'remark-math';
|
||||
import rehypeKatex from 'rehype-katex';
|
||||
import shortcodes from './src/lib/shortcodes.ts';
|
||||
@@ -47,7 +48,8 @@ export default defineConfig({
|
||||
defaultColor: false
|
||||
},
|
||||
processor: unified({
|
||||
remarkPlugins: [remarkMath, [shortcodes, { githubData, siteUrl: siteConfig.site.url }]],
|
||||
gfm: false,
|
||||
remarkPlugins: [[remarkGfm, { singleTilde: false }], remarkMath, [shortcodes, { githubData, siteUrl: siteConfig.site.url }]],
|
||||
rehypePlugins: [rehypeKatex, noticeShortcode, responsiveTables, [externalLinks, { siteUrl: siteConfig.site.url }]]
|
||||
})
|
||||
}
|
||||
|
||||
Generated
+1
@@ -22,6 +22,7 @@
|
||||
"pangu": "^9.1.0",
|
||||
"photoswipe": "^5.4.4",
|
||||
"rehype-katex": "^7.0.1",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"remark-math": "^6.0.0",
|
||||
"twikoo": "1.7.15",
|
||||
"unist-util-visit": "^5.0.0"
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"pangu": "^9.1.0",
|
||||
"photoswipe": "^5.4.4",
|
||||
"rehype-katex": "^7.0.1",
|
||||
"remark-gfm": "^4.0.1",
|
||||
"remark-math": "^6.0.0",
|
||||
"twikoo": "1.7.15",
|
||||
"unist-util-visit": "^5.0.0"
|
||||
|
||||
Generated
+3
@@ -56,6 +56,9 @@ importers:
|
||||
rehype-katex:
|
||||
specifier: ^7.0.1
|
||||
version: 7.0.1
|
||||
remark-gfm:
|
||||
specifier: ^4.0.1
|
||||
version: 4.0.1
|
||||
remark-math:
|
||||
specifier: ^6.0.0
|
||||
version: 6.0.0
|
||||
|
||||
@@ -71,7 +71,7 @@ function normalizeMarkdownHeadings(source: string): string {
|
||||
|
||||
function markdown(source: string, preserveHtml = true, lineNumbers = true): string {
|
||||
const normalized = normalizeMarkdownHeadings(source);
|
||||
const tree = fromMarkdown(normalized, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] });
|
||||
const tree = fromMarkdown(normalized, { extensions: [gfm({ singleTilde: false })], mdastExtensions: [gfmFromMarkdown()] });
|
||||
transform(tree, normalized);
|
||||
if (!preserveHtml) visit(tree, 'html', (node: any) => { if (!node.data?.shortcode) node.value = ''; });
|
||||
const hast = toHast(tree, { allowDangerousHtml: true }) as any;
|
||||
|
||||
Reference in New Issue
Block a user