Embedding Video Code

Hi. I’ve been using Scrivener to generate blog entries. Many of these require that I include html code to embed a video into the page. The following from YouTube might be a typical example:

Currently I’m adding this code after exporting the rest of the entry from Scrivener. But it would be mighty convenient if I could insert the code into my entry before hand in Scrivener such that the video would resolve as part of the web page out of the box. Is there a way to do this?

Thanks,
Tom S.

Hmm, no, there’s non way of doing that, but that is an interesting idea - having some way of telling Scrivener to treat a range of text as raw HTML rather than converting it to HTML. Let me think about it.

All the best,
Keith

Thanks for the reply. Some of my blog posts are a series of bulleted points, often highlighting links and videos around the Internet, usually with a brief comment. I believe this is a fairly common type of post to find around the Internet. You can imagine how useful Scrivener can be in arranging about a 10-15 or so of these into a post. In a good one I might embed as many as four or five videos. I would assume there are others around who commonly do a similar type of operation.

Here is a work around for those who have run into this problem. Its not convenient but it get the job done:

  1. Just put the code into Scrivener in the place where you want the video.
  2. Do whatever you usually do to get the material into html for a blog post.
  3. Edit the html source and do a search and replace substituting “<” for “<” and “>” for “>” without the quotes.

This seems to work for me much of the time while using WordPress to edit the source without much fuss.

Cheers,
Tom S.

That’s an interesting workaround that might be useful in code (although I’ll probably try to make the code version a little more robust). I need to ponder on the best way of telling Scrivener to treat such-and-such-a-range as raw HTML. “Preserve Formatting” would be ideal, really, except that it is already used to, uh, preserve the formatting.

Maybe there could be an option in the “HTML” options pane of Compile along the lines of:

[ ] Treat “Preserve Formatting” blocks as raw HTML

This would allow the user to re-purpose the Preserve Formatting feature for this. In fact, I think this is a good solution, so unless someone has a better idea, I’ll go ahead and add this for 2.0.6.

All the best,
Keith

Out of curiosity, if such code got implemented, would it work then for e-book compiling to allow you within the document itself to assign a heading by just typing in the HTML and then “preserving” it somehow? (I guess I could just play with it once you do it to find out, but it seems like it might.)

Yes, it should - it would allow you to add custom HTML within a document.

Loverly.

Hi, Keith.

Sounds like a great option.

Thanks,
Tom S.