tree-sitter-markdown

npm crates build

Markdown (CommonMark Spec v0.29-gfm) grammar for tree-sitter

Note: This grammar is based on the assumption that link label matchings will never fail since reference links can come before their reference definitions, which causes it hard to do incremental parsing without this assumption.

Changelog

Install

sh npm install tree-sitter-markdown tree-sitter

Usage

```js const Parser = require("tree-sitter"); const Markdown = require("tree-sitter-markdown");

const parser = new Parser(); parser.setLanguage(Markdown);

const sourceCode = `

foo

const tree = parser.parse(sourceCode); console.log(tree.rootNode.toString()); // (document // (atxheading // (atxheadingmarker) // (headingcontent // (text))) // (tightlist // (listitem // (listmarker) // (indentedcode_block // (text)) // (paragraph // (text))))) ```

License

MIT © Ika