Skip to content

Commit b7441ea

Browse files
TrottBethGriggs
authored andcommitted
tools: update doc tools to remark-parse@9.0.0
PR-URL: #36049 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
1 parent d796bc7 commit b7441ea

File tree

6 files changed

+1362
-63
lines changed

6 files changed

+1362
-63
lines changed

tools/doc/addon-verify.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ const { resolve } = require('path');
1111
const vfile = require('to-vfile');
1212
const unified = require('unified');
1313
const remarkParse = require('remark-parse');
14+
const gfm = require('remark-gfm');
1415

1516
const rootDir = resolve(__dirname, '..', '..');
1617
const doc = resolve(rootDir, 'doc', 'api', 'addons.md');
1718
const verifyDir = resolve(rootDir, 'test', 'addons');
1819

1920
const file = vfile.readSync(doc, 'utf8');
20-
const tree = unified().use(remarkParse).parse(file);
21+
const tree = unified().use(remarkParse).use(gfm).parse(file);
2122
const addons = {};
2223
let id = 0;
2324
let currentHeader;

tools/doc/checkLinks.js

+1
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ function findMarkdownFilesRecursively(dirPath) {
4545
function checkFile(path) {
4646
const tree = unified()
4747
.use(require('remark-parse'))
48+
.use(require('remark-gfm'))
4849
.parse(fs.readFileSync(path));
4950

5051
const base = pathToFileURL(path);

tools/doc/generate.js

+2
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ const { promises: fs } = require('fs');
2525
const path = require('path');
2626
const unified = require('unified');
2727
const markdown = require('remark-parse');
28+
const gfm = require('remark-gfm');
2829
const remark2rehype = require('remark-rehype');
2930
const raw = require('rehype-raw');
3031
const htmlStringify = require('rehype-stringify');
@@ -82,6 +83,7 @@ async function main() {
8283
const content = await unified()
8384
.use(replaceLinks, { filename, linksMapper })
8485
.use(markdown)
86+
.use(gfm)
8587
.use(html.preprocessText, { nodeVersion })
8688
.use(json.jsonAPI, { filename })
8789
.use(html.firstHeader)

tools/doc/html.js

+4
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const unified = require('unified');
2727
const find = require('unist-util-find');
2828
const visit = require('unist-util-visit');
2929
const markdown = require('remark-parse');
30+
const gfm = require('remark-gfm');
3031
const remark2rehype = require('remark-rehype');
3132
const raw = require('rehype-raw');
3233
const htmlStringify = require('rehype-stringify');
@@ -56,6 +57,7 @@ const gtocMD = fs.readFileSync(gtocPath, 'utf8')
5657
.replace(/^<!--.*?-->/gms, '');
5758
const gtocHTML = unified()
5859
.use(markdown)
60+
.use(gfm)
5961
.use(remark2rehype, { allowDangerousHtml: true })
6062
.use(raw)
6163
.use(navClasses)
@@ -283,6 +285,7 @@ function parseYAML(text) {
283285
meta.changes.forEach((change) => {
284286
const description = unified()
285287
.use(markdown)
288+
.use(gfm)
286289
.use(remark2rehype, { allowDangerousHtml: true })
287290
.use(raw)
288291
.use(htmlStringify)
@@ -381,6 +384,7 @@ function buildToc({ filename, apilinks }) {
381384

382385
file.toc = unified()
383386
.use(markdown)
387+
.use(gfm)
384388
.use(remark2rehype, { allowDangerousHtml: true })
385389
.use(raw)
386390
.use(htmlStringify)

0 commit comments

Comments
 (0)