get-md-desc

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i get-md-desc

Weekly Downloads

5

Version

1.0.2

License

MIT

Last publish

Collaborators

  • iamstarkov