# tree-sitter-markdown

> Markdown grammar for tree-sitter

Latest version **0.7.1** (published 2021-04-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install tree-sitter-markdown
pnpm add tree-sitter-markdown
yarn add tree-sitter-markdown
bun add tree-sitter-markdown
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.7.1 |
| Published | 2021-04-18 |
| First published | 2019-09-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 1.8 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 193 |
| Author | Ika |
| Maintainers | ikatyang |
| Keywords | parser, lexer |

## Links

- npm: https://www.npmjs.com/package/tree-sitter-markdown
- Repository: https://github.com/ikatyang/tree-sitter-markdown
- Homepage: https://github.com/ikatyang/tree-sitter-markdown#readme
- Issues: https://github.com/ikatyang/tree-sitter-markdown/issues
- npm.io page: https://npm.io/package/tree-sitter-markdown

## Dependencies (1)

- [nan](https://npm.io/package/nan.md) ^2.14.0

## Alternatives

- [babylon](https://npm.io/package/babylon.md) — 5.1M weekly downloads
- [csscolorparser](https://npm.io/package/csscolorparser.md) — 3.7M weekly downloads
- [expr-eval-fork](https://npm.io/package/expr-eval-fork.md) — 1.5M weekly downloads
- [@leeoniya/ufuzzy](https://npm.io/package/@leeoniya/ufuzzy.md) — 247.7K weekly downloads
- [xml-parser](https://npm.io/package/xml-parser.md) — 78.4K weekly downloads

## Recent versions

- 0.7.1 (latest) — 2021-04-18
- 0.7.0 — 2021-04-18
- 0.6.1 — 2021-03-21
- 0.6.0 — 2021-03-14
- 0.5.0 — 2021-01-24
- 0.4.1 — 2021-01-17
- 0.4.0 — 2020-05-24
- 0.3.1 — 2020-04-26
- 0.3.0 — 2019-10-14
- 0.2.0 — 2019-10-01
- 0.1.1 — 2019-10-01
- 0.1.0 — 2019-09-30

## README

# tree-sitter-markdown

[![npm](https://img.shields.io/npm/v/tree-sitter-markdown.svg)](https://www.npmjs.com/package/tree-sitter-markdown)
[![crates](https://img.shields.io/crates/v/tree-sitter-markdown.svg)](https://crates.io/crates/tree-sitter-markdown)
[![build](https://img.shields.io/travis/com/ikatyang/tree-sitter-markdown/master.svg)](https://travis-ci.com/ikatyang/tree-sitter-markdown/builds)

Markdown ([CommonMark Spec v0.29-gfm](https://github.github.com/gfm/)) grammar for [tree-sitter](https://github.com/tree-sitter/tree-sitter)

_Note: This grammar is based on the assumption that **[link label matchings](https://github.github.com/gfm/#matches) will never fail** since reference links can come before their reference definitions, which causes it hard to do incremental parsing without this assumption._

[Changelog](https://github.com/ikatyang/tree-sitter-markdown/blob/master/CHANGELOG.md)

## 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
-     bar
  baz
`;

const tree = parser.parse(sourceCode);
console.log(tree.rootNode.toString());
// (document
//   (atx_heading
//     (atx_heading_marker)
//     (heading_content
//       (text)))
//   (tight_list
//     (list_item
//       (list_marker)
//       (indented_code_block
//         (text))
//       (paragraph
//         (text)))))
```

## License

MIT © [Ika](https://github.com/ikatyang)

---
_Source: https://npm.io/package/tree-sitter-markdown · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
