/get-md-desc

get description from markdown article

Primary LanguageJavaScript

get-md-desc

NPM version Build Status Coveralls Status Dependency Status

get description from markdown article

Install

npm install --save get-md-desc

Usage

import getDesc from 'get-md-desc';

const input = `
# title

* nope

Published yesterday

Or in 21 december 2012

True *description*`;

getDesc(input).text;                       // Published yesterday
getDesc(input, /december/).text;           // Published yesterday
getDesc(input, /Published|december/).text; // True description
getDesc(input, /Published|december/).html; // True <em>description</em>
getDesc(input, /Published|december/).node; // AST node, see commonmark API
getDesc('',    /Published|december/);      // undefined ¯\_(ツ)_/¯

API

getDesc(input, [exclude])

input

Required
Type: String

Markdown string.

exclude

Type: String or RegExp
Default: null

Pattern, which paragraph of description should not contain.

Related

License

MIT © Vladimir Starkov