12

Wouldn't it be awesome if you could put captions under text in images like you can in Wordpress?

If you put underscores around the alt text of the image, the alt text is also used as the caption.


Or, if no one wants to muck with markdown, allow users to embed a caption when uploading pictures. This would not be stylish, but I think it'd work.

3

Markdown already contains a facility for putting a title on the image tag (so when you hover over an image you get a tooltip).

Though there is a caption element defined in HTML, it is only allowable as a child of table.

There is not universally accepted form of markup to caption an image in HTML and as result no such facility in Markdown.

Now, Stack Overflow and Stack Exchange are not the care takers of Markdown - there is no such organisation, as far as I know, so how would this get standarsized?

Additionally, te WMD editor is open source and used by other sites than those in the Stack Exchange family of sites - this means that arbitrary features can't be added willy-nilly. They need to be accepted and approved by others.

My points are:

  1. This is not a simple feature to implement in Markdown
  2. Even if it were, Stack Exchange is not the organisation to do it
  3. The WMD editor is maintained by a community that needs to be convinced that this feature is needed, is worth while and can be easily maintained
  • OK, I'm confusing WMD or whatever they use with "Markdown" itself. I guess I could remove "markdown" from the request. I just want the feature. – Peter Turner Aug 8 '12 at 20:04
  • @PeterTurner WMD is the editor, Markdown is the syntax. – yannis Aug 8 '12 at 20:04
  • 1
    @PeterTurner - The feature is still not something that can simply be added, not without changes to the markdown spec and an understanding of how it is supposed to work across browsers and platforms (seeing as HTML doesn't support it natively). – Oded Aug 8 '12 at 20:05
  • It could be done with CSS3 and custom attributes and just show up as alt text for everyone else. I'm not saying to use a caption element. I'm just saying, put a box underneath an image so I can say figure 2 with style. – Peter Turner Aug 8 '12 at 20:07
  • 1
    @PeterTurner - Yes, it can. At a significant cost of testing and bug fixing and later on maintenance. Frankly, I'd rather see the team work on other features and bug fixes. – Oded Aug 8 '12 at 20:08
  • 1
    Yeah, it's probably not useful to you. It'd be more useful on Physics, Mathematics and Gardening & Landscaping than StackOverflow. – Peter Turner Aug 8 '12 at 20:12
  • @PeterTurner - Possibly, but the WMD editor is closely tied to the meaning of Markdown and adding such a feature that is non standard (and that as far as I can see can't be standardized), to a widely used tool (WMD editor is used on many more sites than the Stack Exchange sites) is just not something I can see happening. Just trying to explain why this is unlikely to happen. – Oded Aug 8 '12 at 20:14
  • Yeah, that's good to know. Kind of stultifying to creativity though, maybe captions could be preprocessed and embedded in the picture when uploaded. – Peter Turner Aug 8 '12 at 20:17
  • Then you'd bump into the whole "don't hide relevant text inside a picture" issue though. Though interesting for some SEs, I can't see a satisfying way out of this to be honest. – Bart Aug 8 '12 at 20:34
  • 2
    No need to enhance Markdown if the Markdown title would be shown? (That would surely be nice on mobile; a bit hard to hover there...) – Arjan Aug 8 '12 at 21:46
  • 4
    Stack Exchange has added their own features to markdown already (spoilers, other site-specific features), so that isn't really an issue. – REINSTATE MONICA -Jeremy Banks Aug 8 '12 at 22:54
0

@Oded: Concerning "There is not universally accepted form of markup to caption an image in HTML" and "HTML doesn't support it natively": What about the <figure> and <figcaption> elements?

The markdown code

![Caption text](image.png)

could be rendered to

<figure>
  <img src="image.png" alt="Caption text">
  <figcaption>Caption text</figcaption>
</figure>

and result in relatively clean and straight-forward HTML code IMHO.

Perhaps the problem of missing standardization remains. As long as the W3C does not standardize it, there will be several different definitions of Markdown that exist and develop in parallel. One MD could implement it, the other not. But is it really a problem?

As Jeremy Banks pointed out in a comment, Stack Exchange for sure could implement this. But I would see more advantages for image captions in writing (scientific) articles than on Stack Exchange. For example in pandoc.

  • No, that markdown can't be rendered into that html because SE wants to adhere to Common Mark so they can't arbitrarily change how that markdown transforms into html. – rene Aug 13 at 16:12
  • Well, that is a different reasoning altogether and seems more valid than the one presented by @Oded. – sgrubsmyon Aug 13 at 20:47
  • back then the initiative to create Common Mark wasn't probably yet started. Oded couldn't have known, or he wasn't yet allowed to disclose it. – rene Aug 13 at 21:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .