dendronhq / dendron

The personal knowledge management (PKM) tool that grows as you do!
https://wiki.dendron.so
Apache License 2.0
6.72k stars 255 forks source link

Auto-embed rich content #533

Open maxkrieger opened 3 years ago

maxkrieger commented 3 years ago

Please Select if your Request is Either something new or an Enhancement

Please select the area your request applys to. (Multiple selections are Possible)

Is your feature request related to a problem? Please describe

I use a lot of twitter/youtube/blog quotes links in my notes. It would be nice to include, in the rendered version, an embedded iframe version of these entities, as opposed to just plaintext links or copy-pasting the embed html.

Describe the solution you'd like

a)

One approach is to use the image syntax ![](https://youtube.com) and run the embedding substitution at render-time

This would match on:

Make sure it matches on mobile URLs too like m.twitter.com

A mild drawback of this approach is that if it's just at render-time (HTML generation), you don't have access to the tweet content in the markdown. If someone deletes the tweet, the textual archive will only be in the git history of the HTML as opposed to that and the markdown. As opposed to twitter's embed HTML code, which pre-caches, in the embed code, plaintext of the tweet while twitter's external JS loads.

b)

VSCode plugin where you run a command to perform the link->HTML embed substitution in-markdown. Drawback: Git-Journal etc won't get to use it, and I use twitter on mobile a lot :P

Describe alternatives you've considered

This older project might provide some inspiration! https://github.com/showdownjs/youtube-extension

Copy paste the external HTML snippet into the markdown. Maybe use VSCode snippets and fill them in.

c)

Shortcodes! WordPress does this https://codex.wordpress.org/Shortcode_API

mandarvaze commented 3 years ago

Adding request to support embedding github gists.

kpathakota commented 3 years ago

There's a lot of improvements to make in terms of embeds/links into Dendron. We don't have a lot of plans here but this thread has some great ideas. If anyone has come across other extensions that do this, it would be super helpful and we can eventually put this functionality into Dendron itself.

v3ss0n commented 2 years ago

https://github.com/cmrd-senya/markdown-it-html5-embed Is the extension you are looking for. I had co-authored the specs back in 2018 and Diaspora developer implemented it.