feat: support markdown breaks

This commit is contained in:
DIYgod
2023-03-09 19:26:00 +00:00
parent 507dcf241e
commit beecd12f0a
3 changed files with 13 additions and 0 deletions
+1
View File
@@ -87,6 +87,7 @@
"rehype-sanitize": "5.0.1",
"rehype-slug": "5.1.0",
"rehype-stringify": "9.0.3",
"remark-breaks": "^3.0.2",
"remark-directive": "2.0.1",
"remark-directive-rehype": "0.4.2",
"remark-frontmatter": "4.0.1",
+10
View File
@@ -108,6 +108,7 @@ specifiers:
rehype-sanitize: 5.0.1
rehype-slug: 5.1.0
rehype-stringify: 9.0.3
remark-breaks: ^3.0.2
remark-directive: 2.0.1
remark-directive-rehype: 0.4.2
remark-frontmatter: 4.0.1
@@ -203,6 +204,7 @@ dependencies:
rehype-sanitize: 5.0.1
rehype-slug: 5.1.0
rehype-stringify: 9.0.3
remark-breaks: 3.0.2
remark-directive: 2.0.1
remark-directive-rehype: 0.4.2
remark-frontmatter: 4.0.1
@@ -11584,6 +11586,14 @@ packages:
unified: 10.1.2
dev: false
/remark-breaks/3.0.2:
resolution: {integrity: sha512-x96YDJ9X+Ry0/JNZFKfr1hpcAKvGYWfUTszxY9RbxKEqq6uzPPoLCuHdZsLPZZUdAv3nCROyc7FPrQLWr2rxyw==}
dependencies:
'@types/mdast': 3.0.10
unified: 10.1.2
unist-util-visit: 4.1.2
dev: false
/remark-directive-rehype/0.4.2:
resolution: {integrity: sha512-T6e+IG+BwqU4++MK54vFb+KDFjs3a+tHeK6E0T0ctR1FSyngolfDtAEzqxHWlRzQZqGi2sB4DFXry6oqH87D/g==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
+2
View File
@@ -30,6 +30,7 @@ import { Mention } from "~/components/ui/Mention"
import remarkMath from "remark-math"
import rehypeKatex from "rehype-katex"
import rehypeInferDescriptionMeta from "rehype-infer-description-meta"
import remarkBreaks from "remark-breaks"
export type MarkdownEnv = {
excerpt: string
@@ -72,6 +73,7 @@ export const renderPageContent = (
try {
result = unified()
.use(remarkParse)
.use(remarkBreaks)
.use(remarkFrontmatter, ["yaml"])
.use(() => (tree) => {
const yaml = tree.children.find((node) => node.type === "yaml")