markdown-it-forwarded-images
v1.1.8
Published
A markdown-it plugin to forward the image to another link
Downloads
5
Maintainers
Readme
markdown-it-linkify-images
A markdown-it plugin to add links to images
Linkifying Images plugin for markdown-it markdown parser.
Install
node.js, browser:
npm install markdown-it-linkify-images --save
bower install markdown-it-linkify-images --save
Use
var md = require('markdown-it')()
var mili = require('markdown-it-linkify-images')
// Basic Use
md.use(mili)
var html = md.render('![the image caption](img/smile.png)')
html // <p><a href="img/smile.png" target="_self"><img src="img/smile.png" alt="the image caption"></a></p>
// With Custom Configuration
md.use(mili, {
target: '_blank',
linkClass: 'custom-link-class',
imgClass: 'custom-img-class'
})
var html = md.render('![the image caption](img/smile.png)')
html // <p><a href="img/smile.png" target="_blank" class="custom-link-class"><img src="img/smile.png" alt="the image caption" class="custom-img-class"></a></p>
Differences in browser. If you load script directly into the page, without a package system, the module will add itself globally as window.markdownitLinkifyImages
.
Testing
This plugin is tested against markdown-it @ 6,7,8 and latest