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

node-md-meta-cataloger

v3.0.0

Published

A module and CLI for parsing Markdown files (including YAML Front Matter metadata).

Downloads

8

Readme

node-md-meta-cataloger

Easily generate a JSON array of markdown files and their inline metadata.

Installation

npm install --save node-md-meta-cataloger

How to Use

CLI Tool

node-md-meta-cataloger -i <dir> -o <path>

node-md-meta-cataloger -i /path/to/folder -o /another/path/catalog.json

node-md-meta-cataloger --help

| Option | Short Flag | Required | Description | | --------------------- | ---------- | -------- | ------------------------------------- | | --input <dir> | -i | true | input directory path | | --output <dir> | -o | true | output path of JSON result | | --delete-filename-ext | -d | false | remove ".md" from filenames in result | | --config | -c | false | path to .js config file | | --version | -v | false | output the version number | | --help | -h | false | output usage information |

Config File (--config)

  • Using the --config option you can specify a path to a JS config file (an ES module) that should return a default object exported with "camelCased" versions of the existing CLI options (plus any extra).
  • If an option exists in both the config file and as a CLI option, then the CLI option will receive priority.

| Option | Type | Required | Description | | ----------------- | -------- | -------- | -------------------------------------------------------- | | input | String | true | input directory path | | output | String | true | output path of JSON result | | normalize | Function | false | receives results as param, returned object is new result | | sort | Function | false | function for sort | | deleteFilenameExt | Boolean | false | remove ".md" from filenames in result if true |

Node Module

readMarkdown(path : String) : array or object

Path parameter may reference a markdown file or folder containing markdown files.

  1. If passed a path to a folder, it returns an array of objects containing all markdown file content and their associated metadata.
  2. If passed a path to a file, it return an object containing the markdown content and its metadata.
import {readMarkdown} from 'node-md-meta-cataloger';

let result = readMarkdown('path/to/folder');

Example value of result above:

[
    {
        content: '<p>markdown content</p>',
        filename: 'example.md',
        filepath: 'path/to/folder/example.md',
        metadata: {
            title: 'Title',
            author: 'Joshua',
        },
    },
];