zelda-js

3.3.1 • Public • Published

Zelda

Installation

npm install zelda-js --save

Usage

const targets = require('zelda-js').targets;
const Zelda = require('zelda-js').Zelda;
 
const zelda = new Zelda({
  tokens: ['$token 1$']
});
 
let linkifiedText = zelda.linkify('... text source ...', targets.BLANK);
let urls = zelda.collectLinks('... text source ...');
 
zelda.setTokens(['$token 2$']);

Options

  • tokens : Array - list of tokens which urls contain

Methods

linkify(text: String, target: String)

  • Convert urls in plain text to HTML <a> tags
  • Handle non-standard urls (with tokens)

collectLinks(text: String)

  • Collect urls and their offsets from plain text
  • Handle non-standard urls (with tokens)
  • Return with the numbers where url found (offsets)

Readme

Keywords

none

Package Sidebar

Install

npm i zelda-js

Weekly Downloads

10

Version

3.3.1

License

MIT

Unpacked Size

50.4 kB

Total Files

35

Last publish

Collaborators

  • dkorpos
  • kaaj
  • m4w4q7
  • s.viktor
  • david.barkoczi
  • dgyenes
  • kkimak
  • emarsys-deployer