Skip to content

parseMarkdown

function parseMarkdown(source): Root;

Parse a markdown string into an mdast AST.

Supports GitHub Flavored Markdown (tables, task lists, strikethrough). Uses unified with remark-parse and remark-gfm.

ParameterTypeDescription
sourcestringRaw markdown string to parse.

Root

The parsed mdast root node.

import { parseMarkdown } from "@semos-labs/glyph-markdown";
const ast = parseMarkdown("# Hello **world**");
console.log(ast.children[0].type); // "heading"