diff --git a/flow/interfaces/node-modules/remark-toc.js b/flow/interfaces/node-modules/remark-toc.js new file mode 100644 index 000000000..7375b7fce --- /dev/null +++ b/flow/interfaces/node-modules/remark-toc.js @@ -0,0 +1,3 @@ +declare module "remark-toc" { + declare var exports: () => void +} diff --git a/package.json b/package.json index 129c1d8b7..8860db653 100644 --- a/package.json +++ b/package.json @@ -68,6 +68,7 @@ "remark-highlight.js": "^4.0.0", "remark-html": "^5.0.0", "remark-slug": "^4.1.0", + "remark-toc": "^3.1.0", "rimraf": "^2.4.2", "rss": "^1.2.0", "semver": "^5.3.0", diff --git a/src/loader-plugin-markdown-transform-body-property-to-html/index.js b/src/loader-plugin-markdown-transform-body-property-to-html/index.js index 5a8b63620..94eff9220 100644 --- a/src/loader-plugin-markdown-transform-body-property-to-html/index.js +++ b/src/loader-plugin-markdown-transform-body-property-to-html/index.js @@ -4,6 +4,7 @@ import remark from "remark" import slug from "remark-slug" import autoLinkHeadings from "remark-autolink-headings" import highlight from "remark-highlight.js" +import toc from "remark-toc" import html from "remark-html" function mdify(text) { @@ -28,6 +29,9 @@ function mdify(text) { // https://github.com/ben-eb/remark-highlight.js .use(highlight) + // https://github.com/wooorm/remark-toc + .use(toc) + // render .process(text, { commonmark: true,