File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242 "markdown-toc" : " ^1.2.0" ,
4343 "rehype-raw" : " ^7.0.0" ,
4444 "rehype-stringify" : " ^10.0.1" ,
45+ "remark-frontmatter" : " ^5.0.0" ,
4546 "remark-parse" : " ^11.0.0" ,
4647 "remark-rehype" : " ^11.1.1" ,
4748 "unified" : " ^11.0.5"
Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import fs from "node:fs/promises";
22import toc from "markdown-toc" ;
33import rehypeStringify from "rehype-stringify" ;
44import rehypeRaw from "rehype-raw" ;
5+ import remarkFrontmatter from "remark-frontmatter" ;
56import remarkParse from "remark-parse" ;
67import remarkRehype from "remark-rehype" ;
78import { unified } from "unified" ;
@@ -85,6 +86,7 @@ class MarkdownResource {
8586
8687 processedMarkdown = await unified ( )
8788 . use ( remarkParse ) // parse markdown into AST
89+ . use ( remarkFrontmatter ) // extract frontmatter out of the AST
8890 . use ( remarkPlugins ) // apply userland remark plugins
8991 . use ( remarkRehype , { allowDangerousHtml : true } ) // convert from markdown to HTML AST
9092 . use ( rehypeRaw ) // support mixed HTML in markdown
You can’t perform that action at this time.
0 commit comments