Definition list as image caption

Michel Fortin michel.fortin at michelf.com
Sat Jun 23 09:43:34 EDT 2012


Le 2012-06-23 à 8:19, Jakob a écrit :


>>> Beside, before we add captions to images, perhaps we could add captions

>> to

>>> tables. I know MultiMarkdown already has that, but not PHP Markdown

>> Extra.

>>> Once we have that we could find a similar way to add caption to various

>>> other things which would wrap the said thing in a figure element. In

>> short,

>>> it should be pretty much the same syntax for both.

>>

>> I totally agree! But why not use the same syntax?:

>>

>> ! caption of the table

>> | user | password |

>> |-------|----------|

>> | frank | 123456 |

>> | mike | mypass |

>

> I think it should be posisible to use tables with captions inside of a figure element: Therefore we need a different syntax for the table caption.


Not at all. If we want to allow anything inside a figure element (as HTML5 permits), then all we have to do is force the figure content to be indented. You could even nest figures that way.

Idea: use "!" to create a figure:

[[ Figure 1: some image ]]
! ![image_alt](image_url "image title")

[[ Figure 2: some text ]]
! paragraph

this is it

blah bla

[[ Figure 3: some code ]]
! ~~~
<html>
~~~

[[ Figure 4: some table ]]
! [ Table 1: passwords for all my friends ]
user | password
---- | --------
mike | mypass

[[ Figure 5: nested figures ]]
! [[ Figure X: another figure ]]
! [[ Figure Y: yet another ]]
! this is getting ridiculous


Now, just make the leading "!" and indentation optional for an image and you get this:

[[ Figure 1: A simple image ]]
![image_alt](image_url "image title")

And preceding the figure with a caption could be optional:

! some figure with text and without a caption

--
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Markdown-Discuss mailing list