UNPKG

710 BPlain TextView Raw
1import unified from "unified";
2// @ts-ignore
3import autolinkLiteral from "mdast-util-gfm-autolink-literal/from-markdown";
4// FIXME: Disable auto link literal transforms that break AST node
5// https://github.com/remarkjs/remark-gfm/issues/16
6// Need to override before import gfm plugin
7autolinkLiteral.transforms = [];
8// Load plugins
9import remarkGfm from "remark-gfm";
10import remarkParse from "remark-parse";
11import frontmatter from "remark-frontmatter";
12import footnotes from "remark-footnotes";
13
14const remark = unified().use(remarkParse).use(frontmatter, ["yaml"]).use(remarkGfm).use(footnotes, {
15 inlineNotes: true
16});
17export const parseMarkdown = (text: string) => {
18 return remark.parse(text);
19};