I like this idea! I think it works quite well with some of the other discussion, too. How does this sound:
Syntax for embedded media is like the syntax for links, with one difference. Instead of link text, we have a media description. The rules for this are the same as for link text, except that (a) a media description starts with
![
or!mediatype[
rather than[
(wheremediatype
is one ofimage
,audio
orvideo
) and (b) a media description may contain links. A media description has inline elements as its contents. When an image is rendered to HTML, this is standardly used as the image’salt
attribute.
- If the mediatype is
image
then the media is rendered as an image. When rendered to HTML it should produce an<img>
element.- If the mediatype is
video
then the media is rendered as embedded video. When rendering to HTML this may produce a<video>
element.- If the mediatype is
audio
then the media is rendered as embedded audio. When rendering to HTML this may produce a<audio>
element.- If the mediatype is not specified, or is unrecognised by the renderer, then the renderer may attempt to determine the type of media by file extension or other means. If it does not, it should default to producing an image.
So that means that existing markup like ![](image.jpg)
will continue to work, as well as items like ![](image.php)
. Markup like ![](music.mp3)
can be rendered as audio tags, as can !audio[](music.php)
.
I like that the syntax is extensible, too: if there are types of embedded media that we haven’t thought of (or haven’t been invented yet!) then it can be incorporated into the scheme without rewriting the spec.