Markdown-it plugin to specify image size
npm install markdown-it-imsize




> A markdown-it plugin for size-specified image markups. This plugin overloads original image renderer of markdown-it.
#### Enable plugin
``js`
var md = require('markdown-it')({
html: true,
linkify: true,
typography: true
}).use(require('markdown-it-imsize')); // <-- this use(package_name) is required
#### Example
`md`
!test
is interpreted as
`html`
#### Auto fill
`js`
var md = require('markdown-it')({
html: true,
linkify: true,
typography: true
}).use(require('markdown-it-imsize'), { autofill: true });
will fill the width and height fields automatically if the specified image path is valid.
Therefore,
`md`
!test
is interpreted as
`html`
where `image.png` is a valid path and its size is 200 x 200.
`markdown-it-imsize` is available with bower and RequireJS. First, you can install the package with,
`shell`
bower install markdown-it-imsize
Script for using `markdown-it-imsize` with RequireJS is like,
`js
require(['require', 'MarkdownIt', 'MarkdownItImsize'], function(require) {
var md = require('MarkdownIt')({
html: true,
linkify: true,
typography: true
}).use(require('MarkdownItImsize'));
var rendered = md.render("!test");
document.getElementById('image-box').innerHTML = rendered;
});
``