arve0/markdown-it-implicit-figures

[question] Is it intended to have a blank line before and after for image caption to work?

Closed this issue ยท 1 comments

This is more like a question than an issue.

with blank lines before & after

So I found out that if we have a blank line before and after the image, caption works fine. ๐Ÿ‘‡

![image caption][https://some.png]

without blank lines before or after

but in either of the following cases, caption doesn't show up ๐Ÿ‘‡

aaa
![image caption][https://some.png]
![image caption][https://some.png]
bbb

Question

So my question is if this is intended?

From the test here: https://github.com/arve0/markdown-it-implicit-figures/blob/master/test.js#L46
I can see that double line spacing is used \n\n, so I'm guessing this might be an intended feature.

So if that's the case, I would like to learn about the reason behind it. ๐Ÿ™

Thanks!

Also, huge thanks again for the plugin! ๐Ÿ˜
(We're building a blogging platform for developers, and having caption helps a lot!)

arve0 commented

Hi! ๐Ÿ˜„ Nice layout, rare I see such well articulated questions ๐Ÿ‘

So my question is if this is intended?

Yes.

From the test here: https://github.com/arve0/markdown-it-implicit-figures/blob/master/test.js#L46
I can see that double line spacing is used \n\n, so I'm guessing this might be an intended feature.

Correct :octocat:

So if that's the case, I would like to learn about the reason behind it. ๐Ÿ™

I'm not sure, but I guess the reason stems from academic publishing (pandoc -> latex -> academia), where figures are often separate from written content. So there is a need for distinction between inline images and figures.

What you might also ask is:

Can we alter it, such that writing newLine img can be used in my blogging platform?

Yes you can! Feel free to poke around in the code and send a PR. For example, enabling figures for "semiInline" images:

md.use(implicitFigures, {
  semiInline: true // enables `text\n![caption](fig.png)` to be rendered as an figure
})