3.0.0 • Published 9 months ago

node-md-meta-cataloger v3.0.0

Weekly downloads
6
License
MIT
Repository
github
Last release
9 months ago

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

OptionShort FlagRequiredDescription
--input \<dir>-itrueinput directory path
--output \<dir>-otrueoutput path of JSON result
--delete-filename-ext-dfalseremove ".md" from filenames in result
--config-cfalsepath to .js config file
--version-vfalseoutput the version number
--help-hfalseoutput 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.
OptionTypeRequiredDescription
inputStringtrueinput directory path
outputStringtrueoutput path of JSON result
normalizeFunctionfalsereceives results as param, returned object is new result
sortFunctionfalsefunction for sort
deleteFilenameExtBooleanfalseremove ".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',
        },
    },
];
3.0.0

9 months ago

2.0.0

5 years ago

1.2.6

5 years ago

1.2.5

5 years ago

1.2.4

5 years ago

1.2.3

5 years ago

1.2.2

6 years ago

1.2.1

6 years ago

1.2.0

6 years ago

1.1.0

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago