YouTube iframe code gotcha in Maruku

It looks like the biggest issue I’m having with Octopress is finding the right MarkDown parser. This seems to be an unsolved problem in the Octopress world at the moment. As I mentioned in a previous post, the default rdiscount, which Brandon recommends as the lesser of all evils, didn’t work for me for various reasons and so I’m now using Maruku.

Maruku, however, has its own demons. One of which you will encounter if you copy and paste YouTube’s default iframe embedding code into one of your posts. That code looks something like

<iframe width="1280" height="720" src="http://www.youtube.com/embed/ecLtts8jLXU" frameborder="0" allowfullscreen></iframe>

And if you add it to your post, you will get an error message like this:

REXML could not parse this XML/HTML: 
<iframe width="1280" height="720" src="https://www.youtube.com/embed/ecLtts8jLXU" frameborder="0" allowfullscreen></iframe>

The culprit here, as far as Maruku is concerned, is the allowfullscreen attribute. It doesn’t like it one bit. Remove it, as shown below, and your video will render happily. Especially after you add a couple of spaces in between the opening and closing iframe tags too. Ah, temperamental MarkDown processors, what’re they like, eh? And, as an additional bonus–at least in my tests–the full screen option in your video remains unscathed.

 

<iframe width="1280" height="720" src="http://www.youtube.com/embed/ecLtts8jLXU" frameborder="0">        </iframe>

Leave a Reply