Skip to content

Commit 89adcea

Browse files
restore frontmatter plugin
1 parent 3b25346 commit 89adcea

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

packages/plugin-markdown/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
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"

packages/plugin-markdown/src/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import fs from "node:fs/promises";
22
import toc from "markdown-toc";
33
import rehypeStringify from "rehype-stringify";
44
import rehypeRaw from "rehype-raw";
5+
import remarkFrontmatter from "remark-frontmatter";
56
import remarkParse from "remark-parse";
67
import remarkRehype from "remark-rehype";
78
import { 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

0 commit comments

Comments
 (0)