nytimes / library

A collaborative documentation site, powered by Google Docs.
https://nyt-library-demo.herokuapp.com/
Apache License 2.0
1.14k stars 143 forks source link

Generalize youtube embeds to support more content #220

Open voshawn opened 4 years ago

voshawn commented 4 years ago

Problem Description

From this https://github.com/nytimes/library/issues/67, it seems like we can embed youtube videos. I would like to be able to embed other content as well. For example, we would like to embed:

  1. Google Drive Videos
  2. Google slides / sheets
  3. Other platforms (for example, our company uses cloudapp for internal video sharing)

Feature

Could we have config settings that allow users to set domains / URL patterns? This way we can decide what type of links we want to parse and how they would be embedded.

We might want to have some embed syntax to avoid automatically embedding everything.

I could try to take a stab at this feature if this is something you think Library should support. It seems like since we already support youtube it would be in scope?

afischer commented 3 years ago

Hey @voshawn, thanks for the issue and sorry for the late reply!

I think this could be a great addition for some specific platforms (youtube, vimeo, maybe google slides, some others!), but we should probably decide on some syntax for embeds vs links as right now, youtube video URLs are automatically turned into embeds, which might be unexpected behavior for some users. Perhaps surrounding a link by double brackets (e.g. [[https://yotutube.com/embedme]] would be an easy way to denote embeddable content.

This might also be a good candidate for a plugin when #249 is complete.

In the mean time, we have an advanced feature that allows for custom code to be inserted directly in the document if desired. If you enable ALLOW_INLINE_CODE, you could insert arbitrary HTML into your google doc. (Note that the example on that linked demo page does not render as the inline code feature is turned off on the public site for security reasons.)