Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

md-list-tree-parser

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

md-list-tree-parser

parse markdown list-style tree to json

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by100%
Maintainers
1
Weekly downloads
 
Created
Source

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",
    "children": [
      {
        "title": "level2",
        "link": "someurl"
      },
      {
        "title": "another level2",
        "link": "someurl",
        "children": [
          {
            "title": "three",
            "link": "....",
            "children": [
              {
                "title": "four",
                "link": ""
              },
              {
                "title": "four",
                "children": [
                  {
                    "title": "five"
                  }
                ]
              }
            ]
          }
        ]
      }
    ]
  },
  {
    "title": "no url",
    "children": [
      {
        "title": "parse to json",
        "link": "url"
      },
      {
        "title": "another level2",
        "link": "url"
      }
    ]
  }
]

more usage

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

FAQs

Package last updated on 07 Nov 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc