Skip to content

Parse and convert markdown into JSON. Headings and lists are nested.

Notifications You must be signed in to change notification settings

cybersemics/md2nestedjson

Repository files navigation

md2nestedjson

Convert markdown to JSON.

  • Nest headings
  • Nest lists
    • optional
  • Uses markdown-it to parse.

Install

npm install md2nestedjson

Usage

const mdToJson = require('md2nestedjson')

const json = mdToJson(`

# md2nestedjson

Convert markdown to JSON.

- Nest headings
- Nest lists
  - optional
- Uses [markdown-it](https://github.com/markdown-it) to parse.

## Install
npm install md2nestedjson

`)

console.log(json)

/*

[{
  value: 'md2nestedjson',
  children: [{
    value: 'Convert markdown to JSON.',
    children: [{
      value: 'Nest headings',
      children: [],
    }, {
      value: 'Nest lists',
      children: [{
        value: 'optional',
        children: [],
      }],
    }, {
      value: 'Uses [markdown-it](https://github.com/markdown-it) to parse.',
      children: [],
    }]
  }]
}, {
  value: 'Install',
  children: [{
    value: 'npm install md2nestedjson',
    children: [],
  }],
}]

*/

About

Parse and convert markdown into JSON. Headings and lists are nested.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published