Render images occurring by itself in a paragraph as `<figure><img ...></figure>`, similar to pandoc's implicit_figures
npm install @geekeren/markdown-it-implicit-figuresRender images occurring by itself in a paragraph as , similar to pandoc's implicit figures.
Example input:
``md
text with 

works with links too:

`
Output: text with works with links too:
`html`


``
$ npm install --save markdown-it-implicit-figures
`js
var md = require('markdown-it')();
var implicitFigures = require('markdown-it-implicit-figures');
md.use(implicitFigures, {
dataType: false, //
figcaption: false, //
tabindex: false, //
link: false //
, default: false
});
var src = 'text with \n\n\n\nanother paragraph';
var res = md.render(src);
console.log(res);
`
- dataType: Set dataType to true to declare the data-type being wrapped,
e.g.: . This can be useful for applying specialfigcaption
styling for different kind of figures.
- : Set figcaption to true to put the alternative text in a
-block after the image. E.g.: !text renders to
`html`

tabindex
- : Set tabindex to true to add a tabindex property to eachtabindex="1"
figure, beginning at and incrementing for each figurelink
encountered. Could be used with this css-trick,
which expands figures upon mouse-over.
- : Put a link around the image if there is none yet.copyAttrs
- : Copy attributes matching (RegExp or string) copyAttrs to figure` element.
MIT © Arve Seljebu