The spec does not mention anything about data URI / base64 content for images, although it is very convenient to embed image resources without an external server, and it is supported by HTML for quite some time now. Data URI are standardized in RFC2397. Rendering to HTML is a no brainer, and for any format if the parser can load images using URI it shouldn’t pose a problem to load the data from a base64 byte array. I propose that the MD spec includes data URI for images.
data URLs are not forbidden in link destinations, so they are allowed since their syntax is compatible with the restrictions (as far as I can see).
A link destination consists of either
a sequence of zero or more characters between an opening
< and a closing
> that contains no spaces, line breaks, or unescaped
> characters, or
a nonempty sequence of characters that does not include ASCII space or control characters, and includes parentheses only if (a) they are backslash-escaped or (b) they are part of a balanced pair of unescaped parentheses. (Implementations may impose limits on parentheses nesting to avoid performance issues, but at least three levels of nesting should be supported.)
Do you wat the spec to explicitly include an example that uses a
Yes, it might be useful to include an example. If you can do it then it would explicit that use case. I received a comment before stating that base64 data URI were not supported in the Markdown spec, so I believe it isn’t clear for everyone.
Looks okay to me:
$ build/src/cmark <<< '!(data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=)'
<p><img src="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACwAAAAAAQABAAACAkQBADs=" alt="" /></p>