
Security News
Axios Maintainer Confirms Social Engineering Attack Behind npm Compromise
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.
Allows you to convert specific words into links. Inspired by Drupal module word_link.
This can be useful for crossposting your site's pages, or for the contextual advertising of your partners (SEO).
bower install word-linknpm install word-linkWordLink.apply(text, word|regexp, url, opts);
| Argument | Type | Default | Details | |
|---|---|---|---|---|
| 1 | text | String | Text in which you want to replace the word to word-links. | |
| 2 | word | String | A String or RegExp that is to be replaced by word-link. | |
| 3 | url | String | A URL to be used to generate a word-link. | |
| 4 | opts | Dictionary | (optional) Additional seetings. | |
| opts.debug | Boolean | false | (optional) Enable debugging mode. Shows a console.log with replaced words. | |
| opts.excludedTags | Array | ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'] | (optional) List of HTML tags to be ignored during replacement. | |
| opts.attributes | Object | {} | (optional) Additional attributes for a link. |
Type: String
Text with replaced word-links.
var WordLink = require('word-link');
var text = "Lorem ipsum dolor sit amet, consectetur adipiscing elit.";
Replace words with a link:
WordLink.apply(text, 'ipsum', 'http://example.com');
// "Lorem <a href="http://example.com">ipsum</a> dolor sit amet, consectetur adipiscing elit."
Find words with regex and replace them with a link:
WordLink.apply(text, '(ipsum|elit)', 'http://example.com');
// "Lorem <a href="http://example.com">ipsum</a> dolor sit amet, consectetur adipiscing <a href="http://example.com">elit</a>."
Word Link understands html. It will ignore existed links and tag attributes:
var html = '<p>Lorem <a href="http://ipsum.com" class="ipsum">ipsum</a> dolor sit amet, consectetur adipiscing elit.</p>';
WordLink.apply(html, 'ipsum', 'http://example.com');
// "<p>Lorem <a href="http://ipsum.com" class="ipsum">ipsum</a> dolor sit amet, consectetur adipiscing elit.</p>"
FAQs
Allows you to convert specific words into links.
The npm package word-link receives a total of 0 weekly downloads. As such, word-link popularity was classified as not popular.
We found that word-link demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.

Security News
The Axios compromise shows how time-dependent dependency resolution makes exposure harder to detect and contain.