Extract tags from your markdown article
npm install --save md-tags
import mdTags from 'md-tags';
const post1 = `
# Title
_January 30, 2016_
#nodejs, #markdown, #my-tag;`;
const post2 = `
# Title
_January 31, 2016_
#nodejs, #just-tag;`;
const post3 = `
# Title
_February 30, 2016_
#markdown, #my-tag;`;
let tags = mdTags().tagsForPost(post1);
tags.md; // #nodejs, #markdown, #my-tag
tags.text; // nodejs, markdown, my-tag
tags.list; // ["nodejs", "markdown", "my-tag"]
let posts = [];
posts.push(post1,post2,post3);
let postsMatchedByTag = mdTags().postsForTag('my-tag', posts);
/*
[
"# Title
_January 30, 2016_
#nodejs, #markdown, #my-tag"
,
"# Title
_February 30, 2016_
#markdown, #my-tag"
]
*/
Return object {md: String, text: String, html: string, list: Array}
.
Required
Type: String
Markdown string.
Return list: Array
array of posts in markdown syntax, which matches by tag.
Required
Type: String
Tag for searching in posts.
Required
Type: Array
Array of posts in markdown syntax
MIT © Aleksandr Filatov