# md-list-tree-parser

> parse markdown list-style tree to json

Latest version **1.3.3** (published 2016-11-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install md-list-tree-parser
pnpm add md-list-tree-parser
yarn add md-list-tree-parser
bun add md-list-tree-parser
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.3.3 |
| Published | 2016-11-10 |
| First published | 2016-11-07 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | bruce.jcw@gmail.com |
| Maintainers | brucejcw |
| Keywords | markdown, list, tree, json |

## Links

- npm: https://www.npmjs.com/package/md-list-tree-parser
- Repository: https://github.com/brucejcw/md-list-tree-parser
- Homepage: https://github.com/brucejcw/md-list-tree-parser#readme
- Issues: https://github.com/brucejcw/md-list-tree-parser/issues
- npm.io page: https://npm.io/package/md-list-tree-parser

## Dependencies (1)

- [fs-extra](https://npm.io/package/fs-extra.md) ^1.0.0

## Alternatives

- [@mapbox/jsonlint-lines-primitives](https://npm.io/package/@mapbox/jsonlint-lines-primitives.md) — 5.3M weekly downloads
- [reftools](https://npm.io/package/reftools.md) — 3.5M weekly downloads
- [@hey-api/openapi-ts](https://npm.io/package/@hey-api/openapi-ts.md) — 3.5M weekly downloads
- [@mapbox/geojson-rewind](https://npm.io/package/@mapbox/geojson-rewind.md) — 2.4M weekly downloads
- [turbo-stream](https://npm.io/package/turbo-stream.md) — 1.7M weekly downloads

## Recent versions

- 1.3.3 (latest) — 2016-11-10
- 1.3.2 — 2016-11-08
- 1.3.1 — 2016-11-08
- 1.3.0 — 2016-11-08
- 1.2.0 — 2016-11-08
- 1.1.0 — 2016-11-07
- 1.0.0 — 2016-11-07

## README

## md-list-tree-parser
parse markdown list-style tree to json

### usage
write your tree list with `-` and two spaces * n at front and one space after `-` for each tree-level in your `tree.md`
```
- [level1](someurl)
  - [level2](someurl)
  - [another level2](someurl)
    - [three](....)
      - [four]()
      - [four]
        - [five]
- [no url]
  - [parse to json](url)
  - [another level2](url)

```
then in your js
```
var parser = require('md-list-tree-parser')
var json = parser('./tree.md')
```
### output
```
[
  {
    "title": "level1",
    "link": "someurl",
    "childNodes": [
      {
        "title": "level2",
        "link": "someurl"
      },
      {
        "title": "another level2",
        "link": "someurl",
        "childNodes": [
          {
            "title": "three",
            "link": "....",
            "childNodes": [
              {
                "title": "four",
                "link": ""
              },
              {
                "title": "four",
                "childNodes": [
                  {
                    "title": "five"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "title": "no url",
    "childNodes": [
      {
        "title": "parse to json",
        "link": "url"
      },
      {
        "title": "another level2",
        "link": "url"
      }
    ]
  }
]
```

### more usage
```
var parser = require('md-list-tree-parser')
var text = $('#tree').text()
var json = parser(text, 'text')
```

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