sol sol - 1 month ago 16
Markdown Question

Simple way to put legend or caption under inserted graph in markdown?

Is there a native markdown way to put caption or legend or key (without requiring some html stuff) under an inserted image or graph like my following example?

![tags](http://matplotlib.org/_images/filled_step_00.png)
<center>**<u>Figure1</u>:** *here would be my legend under this graph*</center>


thanks for incoming help

Answer

In short, No. You need to use HTML.

By "native Markdown" I assume you mean the original basic set of rules defined here. As is clear from a review of those rules, there is no provision for defining a "caption". Of course, some Markdown parsers have included additional add-ons and some of those may include some support for a caption, but it would be non-standard and probably not portable across implementations.

That said, it is not impossible to create a caption via standard Markdown. As the rules state:

For any markup that is not covered by Markdown’s syntax, you simply use HTML itself. There’s no need to preface it or delimit it to indicate that you’re switching from Markdown to HTML; you just use the tags.

But it is clear that that is already known, as the question specifically asks for a solution "without requiring some html stuff". However, notice the previous paragraph in the rules, where the philosophy behind the design decision to allow raw HTML is explained (emphasis preserved):

Markdown is not a replacement for HTML, or even close to it. Its syntax is very small, corresponding only to a very small subset of HTML tags. The idea is not to create a syntax that makes it easier to insert HTML tags. In my opinion, HTML tags are already easy to insert. The idea for Markdown is to make it easy to read, write, and edit prose. HTML is a publishing format; Markdown is a writing format. Thus, Markdown’s formatting syntax only addresses issues that can be conveyed in plain text.

In other words, HTML is the correct tool for the job. Your use case does not fit with Markdown's intended purpose. HTML does fit your intended purpose and as "HTML tags are already easy to insert" you should just use HTML.

Comments