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

md-2-json

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

md-2-json

Markdown to JSON convertor

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2.4K
decreased by-1.33%
Maintainers
1
Weekly downloads
 
Created
Source

MARKDOWN-TO-JSON

A simple library to convert markdown content to JSON object.

Usage

Simple content


var md2json = require('md-2-json');

md2json.parse('This is a markdown content');

/* output
{
    raw: "This is a markdown content\n"
}
*/

Multiline Content


var md2json = require('md-2-json');
var mdContent = `
# Heading 1

This is a para

- This is a list

## Heading 2

This is a para
`

md2json.parse(mdContent);

/* output
{
    "Heading 1": {
        raw: "This is a para\n - This is a list\n",
        "Heading 2": {
            raw: "This is a para\n"
        }
    }
}
*/

Converting JSON to MD string

The method toMd can be used to convert the JSON Object to Markdown string.


var md2json = require('md-2-json');
var json = {
    "Heading 1": {
        raw: "This is a para\n",
    }
}

md2json.toMd(json);

/* output
`
# Heading 1

This is a para

`
*/

Keywords

FAQs

Package last updated on 15 Sep 2017

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