@anthonypena/marked-better-image
v2.0.1
Published
Plugin to improve semantic rendering of images.
Readme
@anthonypena/marked-better-image
Install
npm i @anthonypena/marked-better-imageExamples
Add the plugin to your Marked instance
import { markedBetterImage } from '@anthonypena/marked-better-image';
import { Marked } from 'marked';
const marked = new Marked();
marked.use(markedBetterImage());Transformation
From:


to:
<figure>
<img src="./foo.png" alt="Alternative text"/>
<figcaption>Alternative text</figcaption>
</figure>
<figure>
<img src="./foo.png" alt="Alternative text" title="Caption text"/>
<figcaption>Caption text</figcaption>
</figure>
<figure>
<img src="./foo.png" alt="Alternative text" title="*Caption* **text**"/>
<figcaption><em>Caption</em> <strong>text</strong></figcaption>
</figure>Docs
Parameters
marked (optional): a Marked instance
Default: new Marked instance
