auto-linking-tags
v1.1.6
Published
# Installation
Downloads
22
Readme
auto-linking-tags
Installation
$ npm install auto-linking-tags
Usage
const { TagReplacer } = require('auto-linking-tags');
let handler = new TagReplacer([{"id": <TAG_ID>,"title": <TAG_TITLE>,"slug": <TAG_SLUG>,"url": <TAG_URL>]);
let result = handler.replace( <TEXT_TO_SEARCH_AND_REPLACE> );
Example
let tags = [
{
"id": 950,
"title": "Themaweek",
"url": "/themaweek",
"slug": "themaweek"
},
{
"id": 949,
"title": "Duurzaamheid",
"url": "/Duurzaamhei",
"slug": "Duurzaamheid"
},
{
"id": 951,
"title": "Android 11",
"url": "/android-11",
"slug": "android -11"
},
{
"id": 952,
"title": "Android 10",
"url": "/android-10",
"slug": "android -10"
},
]
let handler = new TagReplacer(tags)
let text = "Android 11 gg /themaweek themaweek -Duurzaamhei Duurzaamheid <a>Android 10</a> Android 10";
let result = handler.replace(text)