markdown
markdown copied to clipboard
Markdown syntax for images that supports sizing and captions
Looks good. A bit bummed about having to move image serialization back to the magic block format… any thoughts on a way to manage captions and sizing in RDMD-flavored syntax?
Originally posted by @rafegoldberg in https://github.com/readmeio/markdown/pull/377#pullrequestreview-821661086
One idea is to use position data:

Or, named attributes:

I've seen somewhere a syntax for adding arbitrary attributes to markdown elements:
{: title="..." sizing="..." caption="..." }
I'm not a fan of position attributes, having to know the order is not friendly. And I think it's a little antithetical to the markdown philosophy to use named attributes at all. It'd be nice if there was a shorthand for it.
This comment has some pretty interesting takes on how to represent captions in a block shorthand. I particularly like the ones that have a prefix for the caption:

: caption

! caption

-- caption
Thanks for opening this @kellyjosephprice! I agree that positional attributes are a pain, and I'm not a big fan of that final arbitrary attribute syntax either. I think I'd say some kind of named attributes are the simplest, and most markdown like, so I'd vote moving in that direction!
A simpler method would be to treat a block immediately following an image as a caption, as from this parent thread:

caption?
@kellyjosephprice @rafegoldberg I'm re-upping this thread (as per a conversation with Kelly) to make a decision on image markdown syntax so I can update images to always use markdown syntax (the current block syntax breaks tables in a bad way, so taking the chance to just update this).
I'm inclined to go with named attributes, despite that they are somewhat un-markdown-like:

Are we cool with this approach? Speak now or (at least temporarily) hold your peace!
Do html tags work for this?
Falavored markdown + centered caption using html tag <p>

_<p style="text-align: center;">Image Caption</p>_
Alternative image caption syntax:
<figure>
<img src="https://files.readme.io/4d1f928-_eafcc389-ea5a-40e2-9539-37ddf358d3d4.jpeg"
alt="Image Alt Text"
title="Image Title">
<figcaption>Alternative Image Caption</figcaption>
</figure>
Image center
alignment
<div style="text-align: center;">
<img src="https://files.readme.io/0f9be14-_eafcc389-ea5a-40e2-9539-37ddf358d3d4_200x200.jpg">
</div>
and image right
alignment.
<div>
<img align="right" src="https://files.readme.io/0f9be14-_eafcc389-ea5a-40e2-9539-37ddf358d3d4_200x200.jpg">
<img align="right" src="https://files.readme.io/0f9be14-_eafcc389-ea5a-40e2-9539-37ddf358d3d4_200x200.jpg">
<img align="right" src="https://files.readme.io/0f9be14-_eafcc389-ea5a-40e2-9539-37ddf358d3d4_200x200.jpg">
<div style="clear:both"></div>
</div>
I've noted, that style
attribute is not supported in GitHub Markdown representation.