diff --git a/docs/README.md b/docs/README.md index 3f97909..e6f0d22 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,4 +1,4 @@ -# Bohrok Animations -- README +# Bohrok Animations – README Makuta has been defeated, but the danger is not past. The insect-like Bohrok swarms have awakened, bringing chaos and destruction everywhere they go. To stop them, the Toa must travel deep underground and be forever transformed. diff --git a/package-lock.json b/package-lock.json index 5ac1686..d649f22 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "archiver": "^6.0.1", "innosetup": "^6.0.5", "marked": "^9.1.2", + "marked-gfm-heading-id": "^3.1.0", "tar": "^6.2.0" }, "optionalDependencies": { @@ -940,6 +941,11 @@ "node": ">=6" } }, + "node_modules/github-slugger": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-2.0.0.tgz", + "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==" + }, "node_modules/glob": { "version": "8.1.0", "resolved": "https://registry.npmjs.org/glob/-/glob-8.1.0.tgz", @@ -1407,6 +1413,17 @@ "node": ">= 16" } }, + "node_modules/marked-gfm-heading-id": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/marked-gfm-heading-id/-/marked-gfm-heading-id-3.1.0.tgz", + "integrity": "sha512-PYgLXDbL64Ga6kCpvVuKVoIVsV6MKUtkOXnR8mIqyjiycAeKNhQxcGpO0mHEogOTzyY8A8TcK49k5VwYMUCCbg==", + "dependencies": { + "github-slugger": "^2.0.0" + }, + "peerDependencies": { + "marked": ">=4 <10" + } + }, "node_modules/merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", diff --git a/package.json b/package.json index 9421cbf..48ccfb8 100644 --- a/package.json +++ b/package.json @@ -16,6 +16,7 @@ "archiver": "^6.0.1", "innosetup": "^6.0.5", "marked": "^9.1.2", + "marked-gfm-heading-id": "^3.1.0", "tar": "^6.2.0" } } diff --git a/util/doc.mjs b/util/doc.mjs index acda3e7..093a3d9 100644 --- a/util/doc.mjs +++ b/util/doc.mjs @@ -2,6 +2,7 @@ import {readdir, readFile, stat, writeFile} from 'fs/promises'; import {pathToFileURL} from 'url'; import {marked} from 'marked'; +import {gfmHeadingId} from 'marked-gfm-heading-id'; import {templateStrings} from './string.mjs'; @@ -35,12 +36,13 @@ export async function docs(src, dst) { breaks: true, smartypants: true }; + const ext = [gfmHeadingId({})]; await Promise.all( (await readdir(src)) .filter(f => /^[^\.].*\.md$/i.test(f)) .sort() .map(f => readFile(`${src}/${f}`, 'utf8').then(md => { - const body = marked(md, options).trim(); + const body = marked.use(...ext)(md, options).trim(); const title = firstHeader(body); return writeFile( `${dst}/${f}`.replace(/\.md$/i, '.html'),