auto-linking-tags
TypeScript icon, indicating that this package has built-in type declarations

1.1.4 • Public • Published

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)

Readme

Keywords

none

Package Sidebar

Install

npm i auto-linking-tags

Weekly Downloads

5

Version

1.1.4

License

ISC

Unpacked Size

7.22 kB

Total Files

11

Last publish

Collaborators

  • albatarnik