Extensions
chrisalley — 2014-09-05T23:00:25-04:00 — #1
Markdown includes syntax for embedding images, but not audio and video files. Embedded video in particular has become a lot more commonplace since John Gruber wrote the original Markdown spec. It would be good to have a standard, er common, way to embedded audio and video using Markdown.
I currently use the following syntax, transforming image tags based on particular file extensions:

produces
<audio controls="controls">
<source type="audio/mp3" src="filename.mp3"></source>
<source type="audio/ogg" src="filename.ogg"></source>
<p>Your browser does not support the audio element.</p>
</audio>
And for video:

produces:
<video controls="controls">
<source type="video/mp4" src="filename.mp4"></source>
<source type="video/webm" src="filename.webm"></source>
<p>Your browser does not support the video element.</p>
</video>
mofosyne — 2014-09-07T00:52:36-04:00 — #2
I think this would go under http://talk.standardmarkdown.com/t/generic-directives-plugins-syntax/444/5 about general directives.
Personally think we should explicitly say if it's a video or not. Makes parsing a heck of a lot more easier to do e.g.
!video[ title ]( url ){ size=10 }
!audio[ title ]( url ){ size=10 duration=10 cycle=forever }
!youtube[ title ]( url ){ size=10 cycle=forever }
This is since I think ![]()
is by default considered to be an image.
chrisalley — 2014-09-07T01:11:25-04:00 — #3
Thanks, I'll check out that other topic.
I'm not sure if ease of parsing should be the main aim here though. With Markdown, the goal was for readability to be emphasised above all else.
mofosyne — 2014-09-07T02:25:06-04:00 — #4
I see well that could work. What if the url don't say .mp3 but should be treated as audio? I guess we could do both
chrisalley — 2014-09-07T04:04:19-04:00 — #5
The solution I posted works because the system deals with very particular file formats and extensions. I can see it creating problems with more flexible systems.
Something like the solution you posted seems good. I would use sensible defaults for the options, rather than getting the user to explicitly define them.