This package has been deprecated

Author message:

Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

comment-meta
TypeScript icon, indicating that this package has built-in type declarations

0.1.1 • Public • Published

Comment Meta

An HTML/Markdown comment metadata parsing tool.

Example

var meta = require(".").default;
var assert = require("assert");
 
var html = '<!--\n'
    + 'title: Hello, World!\n'
    + 'author: Ayon Lee\n'
    + 'author email: i@hyurl.com;\n'
    + '-->\n'
    + '<h1>This is a title</h1>\n'
    + '<!-- title: Hello, World!; author: Ayon Lee; author email: i@hyurl.com -->\n'
    + '<!-- This comment will not be parsed -->\n'
    + '<!-- This comment\n'
    + 'will not be parsed as well -->';
 
var expected = [
    {
        title: "Hello, World!",
        author: "Ayon Lee",
        "author email": "i@hyurl.com"
    },
    {
        title: "Hello, World!",
        author: "Ayon Lee",
        "author email": "i@hyurl.com"
    }
];
 
assert.deepStrictEqual(meta(html), expected);
 
console.log("#### OK ####");

Meta Style

This tool allows you setting metadata in HTML/Markdown comments, in the style of <key>: <value>, separated by semicolons (;) or line endings (\n), and parse them into an array of objects stored all key-value pairs. See the above example.

Readme

Keywords

Package Sidebar

Install

npm i comment-meta

Weekly Downloads

0

Version

0.1.1

License

MIT

Unpacked Size

3.69 kB

Total Files

7

Last publish

Collaborators

  • ayonli