markdown-it-replace-link
markdown-it plugin for replacing links (image & text) in the markdown document.
Last updated 5 months ago by leichtgewicht .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install markdown-it-replace-link 
SYNC missed versions from official npm registry.

markdown-it-replace-link

markdown-it plugin for replacing links (image & text) in the markdown document.

Usage

Enable plugin

var md = require('markdown-it')({
    replaceLink: function (link, env) {
        return link + "?c=" + Date.now();
    }
}).use(require('markdown-it-replace-link')); // <-- this use(package_name) is required

Example

[Hello](test)

and use this

var md = require('markdown-it')({
    replaceLink: function (link, env) {
        return "http://me.com/" + link;
    }
}).use(require('markdown-it-replace-link'));

This will result in the link prefixed with the http://me.com/ like:

<p><a href="http://me.com/test">Hello</a></p>

Both images and html links will be processed.

If using this in a browser, the script will create a variable window.markdownitReplaceLink that can be passed to .use().

Testing

To run the tests use:

npm run test

License

MIT

Current Tags

  • 1.1.0                                ...           latest (5 months ago)

3 Versions

  • 1.1.0                                ...           5 months ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 0
This Week 61
This Month 632
Last Day 61
Last Week 156
Last Month 518
Dependencies (0)
None
Dev Dependencies (4)

Copyright 2014 - 2016 © taobao.org |