开发者

How can I embed a YouTube video in a Markdown enabled text field?

This is the code I'm trying to embed:

<object width="480" height="385"><param name="movie" value="http://www.youtube.com/v/jJECepNeCJ0&amp;hl=en_US&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http开发者_开发知识库://www.youtube.com/v/jJECepNeCJ0&amp;hl=en_US&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object>

The interesting thing is that this code seems to display the embedded video in the Preview immediately below the form. Once the form is saved, the code snippet is rendered as text.


It works fine for me.
Make sure your code snippet doesn't have four spaces before it.


You're probably going to have to extend whatever markdown filter you're using (assuming django.contrib.markup) to ignore <object> tags.

If you're using some sort of Javascript editor in your form, it may be converting the < to &lt; before it is saved into your database. In this case, you may have to change the editor.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜