Sun 20 Apr 2014 11:44AM

markdown to play videos html5

JS Juan Santiago Public Seen by 120

For a free system does not seem good thing to embed youtube videos and not free to embed video formats, now that we think good idea implemetarlo html5 video and audio.

In this way we could play videos hosted on our own servers or some mediaglobin server.

We need this output:

   Your browser does not implement html5 video.

Could a markdown used like this?

!!! Alt text


Thomas Leister Sun 20 Apr 2014 11:59AM

I like your idea. You are right, it would be wrong to support YouTube flash (!) videos, but not html5 video.

Who manages the markdown standard? Are there drafts concerning html5 video, yet?


rekado Sun 20 Apr 2014 11:59AM

It is fairly difficult to extend the syntax supported by redcarpet (the markdown library used by Diaspora). This is why for Libertree we use rpeg-markdown, which provides ruby bindings to peg-markdown, a markdown implementation using an extensible grammar (PEG).

I forked the unmaintained rpeg-markdown and forked peg-markdown to implement non-standard syntax for embedding videos and audio files.

The syntax we use for video files is this:

%[caption](URLs to video files)

This is the syntax for audio files:


The percentage sign looks a little like the progress indicator on a video player; the tilde looks a bit like a waveform.

Here's the code of the ruby library:

This is the code of the forked C library with the extended grammar:

You are welcome to use this library in Diaspora. peg-markdown is really fast, but it consumes a bit more memory while rendering (freed after completion).


Alberto Aru Sun 20 Apr 2014 4:37PM

Thank you @rekado for this information, but why Diaspora uses redcarpet instead of rpeg-markdown? I think that if this m↓ is so good, we should promote it and implement it on Diaspora.

Maybe you should make another Loomio discussion talking about it.


[email protected] Sun 20 Apr 2014 4:48PM

Great discussion and work. Ruby is kind of what I learn't on codecademy so that's cool I could work with it supposedly.

I also believe that html 5 supports browser data so perhaps a option that when a user uploads a video they can have the option to host on pod database or through their own database. a icon could show to other's which option the poster chose and then a notification for when the poster is offline saying the media will be available again when there online?


rekado Mon 21 Apr 2014 12:08AM

@albertoaru The reason is likely that redcarpet is by far the most popular implementation for ruby. Initially, Libertree used redcarpet, but I decided to switch to peg-markdown when we extended the set of supported syntax. Redcarpet's parser is a fairly confusing tangle of code; it's no fun to extend, whereas peg-markdown only requires changes to the formal grammar. The parser code is generated from the grammar.

@williammouck This discussion is about a markdown extension, not about video upload.


lebarjack Tue 22 Apr 2014 7:25AM

Are you sure redcarpet is not extensible? I had a quick glance at the readme and it seems to be.


Jonne Haß Tue 22 Apr 2014 5:20PM

We only use redcarpet for rendering emails and the mobile site, the desktop version is rendered client side through pagedown.

If we implement this, we need to make sure to make them click to load, to save bandwidth and to not dramatically increase stream render time.


Juan Santiago Tue 22 Apr 2014 8:06PM

Jonne Haß:
All resources saving ideas seem good, but remember we are talking about external files, not video stay in pods (each pod can make this decision depends resources)
Your say do not load previews? Or are you talking about not autoplay? The autoplay is a bad practice, must be banished


Jonne Haß Wed 23 Apr 2014 6:44AM

I'm saying to not load the files in the background to save the users resources.


rekado Wed 23 Apr 2014 11:13PM

@jonnehass Ah, I did forget about the move to client-side template rendering (I last looked at the code when rendering was still done on the server).

Preloading can be disabled with the attribute preload=none (though the actual behaviour depends on the UA).

Load More