|
|
преди 6 месеца | |
|---|---|---|
| .. | ||
| coverage | преди 6 месеца | |
| dist | преди 6 месеца | |
| lib | преди 6 месеца | |
| test | преди 6 месеца | |
| .coveralls.yml | преди 6 месеца | |
| .eslintignore | преди 6 месеца | |
| .eslintrc | преди 6 месеца | |
| .npmignore | преди 6 месеца | |
| .travis.yml | преди 6 месеца | |
| Makefile | преди 6 месеца | |
| README.md | преди 6 месеца | |
| bower.json | преди 6 месеца | |
| package.json | преди 6 месеца | |
| webpack.config.js | преди 6 месеца | |
A markdown-it plugin for size-specified image markups. This plugin overloads original image renderer of markdown-it.
var md = require('markdown-it')({
html: true,
linkify: true,
typography: true
}).use(require('markdown-it-imsize')); // <-- this use(package_name) is required

is interpreted as
<p><img src="image.png" alt="test" width="100" height="200"></p>
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,

is interpreted as
<p><img src="image.png" alt="test" width="200" height="200"></p>
where image.png is a valid path and its size is 200 x 200.
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("
");
document.getElementById('image-box').innerHTML = rendered;
});
```