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

mds-to-json

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mds-to-json

parse md file to json.

  • 0.0.4
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

mds-to-json

parse md files to json.

  • usage
npm install
  • test
npm run test

example:

var mdToJson = require('../src/index.js'),
    path = require('path');

let {
    parsedFiles
} = mdToJson({});

var res = parsedFiles(path.join(__dirname, './_posts'));
console.log(res.total);
console.log(res.data[0].meta);
console.log(res.data[0].summary);
console.log(res.data[0].content);

output

  • res type: Object
var res = {
    total: 10,
    data: [
        {
            meta:{ title: '简单的dom库和轻量级mvvm框架的尝试',
            date: 2016-02-21T19:07:19.000Z,
            tags: [ 'js' ],
            id: '0',
            createTime: '2016-02-22',
            url: '2016-02-22-简单的dom库和轻量级mvvm框架的尝试',
            strTag: 'js' }
        }
    ]
}

API

  • parseFiles | Function

    return parsed data by json. 按 json 格式返回处理后的数据.

  • use add a plugin

  • parse

    • params
      • marked: Object marked options
      • dirname: 'String' the soure dirname

    parse file use plugin

  • plugins

examples:

var mdToJson = require('mds-to-json')();

mdToJson.use((res, next)=>{
    console.log(res.total);

    next(res);
})

mdToJson.use('printTotal', (res, next)=>{
    console.log(res.total);

    next(res);
})

mdToJson.parse((res)=>{
    console.log(res);
})

who used?

ssr-web(A fast, simple & powerful blog framework, powered by Node.js and Vue.)

Keywords

FAQs

Package last updated on 25 Feb 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