npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

md2json

v0.0.5

Published

将markdown转换为json,适用于带meta的文章类markdown

Downloads

11

Readme

md2json

#Introduction

md2json可以提取带有meta的Markdown内容,并返回一个JSON格式的数据。一个很常见的应用,是提取博客文章中的meta。md2json支持自定义meta中的key,并且可以设置数据格式

#Usage

##scan(dir, filter, maps, callback);

@summary 扫描所有的markdown

@param {String} dir - 要扫描的文件夹

@param {Array | RegExp} filter - 过滤条件,Array: 根据扩展名过滤;RegExp:根据正则过滤

@param {Array | null} maps - 影射规则

@param {Function} callback - 回调函数,callback(json);

##convert(text, maps);

@summary 转换markdown格式的文本为article

@param {String} text - markdown格式的文本

@returns {Object} 返回转换后的JSON数据

##参数变量 ###maps

maps提取meta的映射列表,如果此项为false,则提取所有的meta。一个合法的map应该包含:

  • match 必选,可以是正则或者字符型,用于匹配meta中的key
  • key 可选,映射后的key,如果没有设置,则会使用原来的key
  • type 可不设置,或者设置为arraydate
  • separator 如果typearray,则此项可以设置数组的分隔符,默认为,
  • format 如果typedate,则此项可设置为日期的格式化表达式,详细请参考moment.js

#Test

mocha

#Author

Conis

Blog: http://iove.net

E-mail: [email protected]