1.0.3 • Published 9 months ago
@anthonypena/marked-better-image v1.0.3
@anthonypena/marked-better-image
Install
npm i @anthonypena/marked-better-image
Examples
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