This appears to be better off as a generic extension http://talk.commonmark.org/t/generic-directives-plugins-syntax
@name[content](arg){#myId .myClass key=val key2="val 2"}
@@@name[content](arg){#myId .myClass key=val key2="val 2"}
\*Content to pass to extension*\
@@@
For consistency, with http://talk.commonmark.org/t/consistent-attribute-syntax . Note that we refer to id based anchors in {}
as {#id}
not {id}
!mediaType[description](url){#myId .myClass key=val key2="val 2"}
- assumed to be image if mediaType left blank
So therefore:
Singular figure:
@figure[ ![A voyage to the moon](moon.jpg) ]{ #themoon }
Block figure:
@@@figure{ #themoon }
![A voyage to the moon](moon.jpg)
@@@
This links to the figure:
@figure( #themoon )
Where @figure( #themoon )
prints out the current figure name/number .
Or if we are adopting multiple levels of specification Optional syntax
We could use your suggested syntax (fixed for consistancy with other threads)
![A voyage to the moon](moon.jpg){#fig:themoon}
[This figure](#fig:themoon)
But make it part of CommonMark Scholar Extension
BTW: Do you know that HTML now supports a figure tag & figure caption tag?
http://www.w3schools.com/tags/tag_figure.asp
http://www.w3schools.com/tags/tag_figcaption.asp