Hello everyone. I’m a new user, although not a new reader of this forum. I would like to propose a new extension addressing figure-like constructs in markdown.
First my stance on markdown: what is neat in markdown is the fact that it reuses well ingrained written conventions in order to provide semantics and do a good job interpreting as HTML. In several discussions talking about figurification (sorry I made up a word) and adding captions I was struck by the unnatural constructs proposed to do so, that is: new kinds of markups. I think this should be avoided when possible.
And what is a figure? In my opinion it is a standalone construct with a text written below it. If I wanted to represent a figure in plain text I would therefore present it as such.
A paragraph. ![my alt text](https://www.example.com/image.png "my title") A convenient caption below my image standing alone in a paragraph.
Because if I wrote the code for an image inside a paragraph, my intention would therefore have been that the image integrates with the flow of text. But if I write it that way, my intention is that the image is a thing in itself, and we know it is a figure because I took the time to give a text with it below (aka a caption).
In core markdown it would render gracefully as such (fixed example):
<p>A paragraph.</p> <p><img src="https://www.example.com/image.png" alt="my alt text" title="my title"> A convenient caption below my image standing alone in a paragraph.</p>
Which is neat and breaks neither the flow for the one who reads the markdown nor adds some weird stuff for the one who reads the rendered HTML. But with an extension it could be rendered as this:
<p>A paragraph.</p> <figure> <img src="https://www.example.com/image.png" alt="my alt text" title="my title"> <figcaption>A convenient caption below my image standing alone in a paragraph.</figcaption> </figure>
And it would generalize well with code blocks, tables (for extensions that knows about tables), embedded content (for extensions that generalize image constructs), and even blockquotes, although in this case it could serve a footer of the blockquote and not make a figure of it, because blockquotes are not the kind of things that goes in a figure in the first place. For example (fixed example and rendering to correspond what I intended):
A paragraph. > May the force be with you, always. > Master Obi-wan Kenobi.
By default renders as this:
<p>A paragraph.</p> <blockquote> <p>May the force be with you, always.</p> </blockquote> <p>Master Obi-wan Kenobi.</p>
Which is readable and understandable in the context. But with this extension it would render as follows:
<p>A paragraph.</p> <blockquote> <p>May the force be with you, always.</p> <footer>Master Obi-wan Kenobi.</footer> </blockquote>
I think this proposal respects the philosophy of markdown by being lightweight, not imposing new markups to people but interpreting better the way we write in plain text. The context does the job.
What do you think?