Definition linker
Utility to automatically create links to definition URLs, in a given block of text/HTML.
A stemmer method must be provided to match the words given block of text/HTML with the configured definition words.
Usage
Basic
const natural = ;const definition_linker = { // keepStops=true return naturalPorterStemmerFr; }; definition_linker; definition_linker;definition_linker;// etc. const html = definition_linker;
Advanced
addLinksInHtml
and addLinksInText
accept an optional parameter to exclude
linking to a specific definition.
const natural = ;const definition_linker = { // keepStops=true return naturalPorterStemmerFr; }; definition_linker; definition_linker;definition_linker;// etc. const html1 = definition_linker; const html2 = definition_linker;
Nolink
It is possible to disable linking on some terms in the HTML by setting a "nolink" class:
const natural = ;const definition_linker = { // keepStops=true return naturalPorterStemmerFr; }; definition_linker; definition_linker;definition_linker
Development
It is possible to disable linking on some terms in the HTML by setting a "nolink" class:
export DEBUG='definition-linker'npm test
Contributions
Pull Requests and contributions in general are welcome as long as they follow the Node aesthetic.