read metadata from markdown files
JavaScript
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
test
.gitignore
README.md
package.json

README.md

markdown-meta

read metadata from markdown files, or convert a js metadata object to markdown comment form

Installation

Just the markdown-meta library:

npm install markdown-meta

Optionally, install markdown-meta into your path

npm install -g markdown-meta

Usage

Use <!--* and *--> tags in the markdown files to include the metadata.

Inside the backend code:

var markdown_meta = require('markdown-meta');
var content = "<!--* author: chun *-->";
var metadata = markdown_meta.parse(content);

var toMarkdown = markdown_meta.toMarkdown(metadata);

Inside the client code:

<script type='type/javascript' src='markdown-meta.js'></script>
<script type='type/javascript'>
    var content = "<!--* author: chun *-->";
    var metadata = markdown_meta.parse(content);
    var toMarkdown = markdown_meta.toMarkdown(metadata);
</script>

the metadata will be a Javascript Object.

Metadata Format

key: value;

Please use the : to separate the key and value, use ; to separate different key-value pairs.

Example

<!--*
    author: chun;
    title : Welcome to use markdown-meta;
    tags  : ["markdown", "metadata"];
*-->