arve0/markdown-it-implicit-figures

markdown-it-attrs applies attributes to <img> instead of <figure>

Closed this issue · 4 comments

Not sure if this is intended or a bug.
I'm using "markdown-it-implicit-figures": "^0.6.0", and "markdown-it-attrs": "^1.2.1", running Nuxt.js (webpack) and "@nuxtjs/markdownit": "^1.2.0",

If intended, is there a way to apply attributes to the <figure> ?

Example:

![captiontext](cat.jpg "titletext"){.align-left} 

becomes:

<figure>
  <img src="cat.jpt" alt="captiontext" title="titletext" class="align-left">
  <figcaption>captiontext</figcaption>
</figure>

what I'd like to have:

<figure class="align-left">
  <img src="cat.jpt" alt="captiontext" title="titletext">
  <figcaption>captiontext</figcaption>
</figure>
arve0 commented

Copying or moving attributes from the image is not implemented as of now. Implementing it should be straight forward, feel free to poke around in the code.

okay, that's unfortunate, but thanks for the quick reply! I'll see if I can figure it out..

There is a branch which copies attributes here.

arve0 commented

Fixed in v0.9.0, thanks @dgerber 😸