Created
September 29, 2016 15:06
-
-
Save MoOx/e086b2bd9e31bf6d2e95dc24b51735a9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { | |
return remark() | |
// https://github.com/wooorm/remark-slug | |
.use(slug) | |
// https://github.com/wooorm/remark-html | |
.use(html, { entities: "escape" }) | |
// https://github.com/ben-eb/remark-highlight.js | |
.use(highlight) | |
// https://github.com/wooorm/remark-toc | |
.use(toc) | |
// render | |
.process(text, { | |
commonmark: true, | |
}) | |
.toString() | |
} | |
export default ({ result }) => { | |
return { | |
...result, | |
body: mdify(result.body), | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment