tools: added remark-frontmatter

remark-frontmatter allows the use of frontmatter metadata in markdown
files

PR-URL: https://github.com/nodejs/node/pull/38717
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Reviewed-By: Derek Lewis <DerekNonGeneric@inf.is>
This commit is contained in:
Ben Halverson authored and Michaël Zasso committed 2021-09-04 15:14:31 +02:00
1 parent 1e5aca550c
commit d2c0da20a0
3 files changed
+109

No files matched your search

+2
View File
@@ -27,6 +27,7 @@ import htmlStringify from 'rehype-stringify';
import gfm from 'remark-gfm';
import markdown from 'remark-parse';
import remark2rehype from 'remark-rehype';
import frontmatter from 'remark-frontmatter';
import unified from 'unified';
import * as html from './html.mjs';
@@ -82,6 +83,7 @@ async function main() {
const input = await fs.readFile(filename, 'utf8');
const content = await unified()
.use(frontmatter)
.use(replaceLinks, { filename, linksMapper })
.use(markdown)
.use(gfm)
+106
View File
@@ -15,6 +15,7 @@
"js-yaml": "4.1.0",
"rehype-raw": "5.1.0",
"rehype-stringify": "8.0.0",
"remark-frontmatter": "^3.0.0",
"remark-gfm": "^1.0.0",
"remark-html": "13.0.1",
"remark-parse": "^9.0.0",
@@ -181,6 +182,28 @@
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
"dev": true
},
"node_modules/fault": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz",
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
"dev": true,
"dependencies": {
"format": "^0.2.0"
},
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/format": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz",
"integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=",
"dev": true,
"engines": {
"node": ">=0.4.x"
}
},
"node_modules/hast-to-hyperscript": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz",
@@ -551,6 +574,19 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/mdast-util-frontmatter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-0.2.0.tgz",
"integrity": "sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==",
"dev": true,
"dependencies": {
"micromark-extension-frontmatter": "^0.2.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/mdast-util-gfm": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.2.tgz",
@@ -712,6 +748,19 @@
"parse-entities": "^2.0.0"
}
},
"node_modules/micromark-extension-frontmatter": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-0.2.2.tgz",
"integrity": "sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==",
"dev": true,
"dependencies": {
"fault": "^1.0.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/micromark-extension-gfm": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz",
@@ -873,6 +922,20 @@
"url": "https://opencollective.com/unified"
}
},
"node_modules/remark-frontmatter": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-3.0.0.tgz",
"integrity": "sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==",
"dev": true,
"dependencies": {
"mdast-util-frontmatter": "^0.2.0",
"micromark-extension-frontmatter": "^0.2.0"
},
"funding": {
"type": "opencollective",
"url": "https://opencollective.com/unified"
}
},
"node_modules/remark-gfm": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-1.0.0.tgz",
@@ -1380,6 +1443,21 @@
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==",
"dev": true
},
"fault": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/fault/-/fault-1.0.4.tgz",
"integrity": "sha512-CJ0HCB5tL5fYTEA7ToAq5+kTwd++Borf1/bifxd9iT70QcXr4MRrO3Llf8Ifs70q+SJcGHFtnIE/Nw6giCtECA==",
"dev": true,
"requires": {
"format": "^0.2.0"
}
},
"format": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/format/-/format-0.2.2.tgz",
"integrity": "sha1-1hcBB+nv3E7TDJ3DkBbflCtctYs=",
"dev": true
},
"hast-to-hyperscript": {
"version": "9.0.1",
"resolved": "https://registry.npmjs.org/hast-to-hyperscript/-/hast-to-hyperscript-9.0.1.tgz",
@@ -1640,6 +1718,15 @@
"unist-util-stringify-position": "^2.0.0"
}
},
"mdast-util-frontmatter": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/mdast-util-frontmatter/-/mdast-util-frontmatter-0.2.0.tgz",
"integrity": "sha512-FHKL4w4S5fdt1KjJCwB0178WJ0evnyyQr5kXTM3wrOVpytD0hrkvd+AOOjU9Td8onOejCkmZ+HQRT3CZ3coHHQ==",
"dev": true,
"requires": {
"micromark-extension-frontmatter": "^0.2.0"
}
},
"mdast-util-gfm": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/mdast-util-gfm/-/mdast-util-gfm-0.1.2.tgz",
@@ -1757,6 +1844,15 @@
"parse-entities": "^2.0.0"
}
},
"micromark-extension-frontmatter": {
"version": "0.2.2",
"resolved": "https://registry.npmjs.org/micromark-extension-frontmatter/-/micromark-extension-frontmatter-0.2.2.tgz",
"integrity": "sha512-q6nPLFCMTLtfsctAuS0Xh4vaolxSFUWUWR6PZSrXXiRy+SANGllpcqdXFv2z07l0Xz/6Hl40hK0ffNCJPH2n1A==",
"dev": true,
"requires": {
"fault": "^1.0.0"
}
},
"micromark-extension-gfm": {
"version": "0.3.3",
"resolved": "https://registry.npmjs.org/micromark-extension-gfm/-/micromark-extension-gfm-0.3.3.tgz",
@@ -1875,6 +1971,16 @@
"hast-util-to-html": "^7.1.1"
}
},
"remark-frontmatter": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/remark-frontmatter/-/remark-frontmatter-3.0.0.tgz",
"integrity": "sha512-mSuDd3svCHs+2PyO29h7iijIZx4plX0fheacJcAoYAASfgzgVIcXGYSq9GFyYocFLftQs8IOmmkgtOovs6d4oA==",
"dev": true,
"requires": {
"mdast-util-frontmatter": "^0.2.0",
"micromark-extension-frontmatter": "^0.2.0"
}
},
"remark-gfm": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/remark-gfm/-/remark-gfm-1.0.0.tgz",
+1
View File
@@ -11,6 +11,7 @@
"js-yaml": "4.1.0",
"rehype-raw": "5.1.0",
"rehype-stringify": "8.0.0",
"remark-frontmatter": "^3.0.0",
"remark-gfm": "^1.0.0",
"remark-html": "13.0.1",
"remark-parse": "^9.0.0",