Search code examples
markdown

Insert embeded YouTube video in Markdown, VS Code


I need to insert autoplaying YouTube video in Markdown, VS Code, how can I do it?

![video](YouTube link)

Solution

  • In case you can't use HTML elements like iframe

    I made an API which gets the video's thumbnail, then adds a play button and backdrop to it.

    You can use it in markdown like this:

    [![](https://markdown-videos-api.jorgenkh.no/youtube/{video_id})](https://youtu.be/{video_id})
    

    Clicking on the image will open the video in your browser.

    Demo:

    [![](https://markdown-videos-api.jorgenkh.no/youtube/dQw4w9WgXcQ)](https://youtu.be/dQw4w9WgXcQ)
    

    GitHub repo can be found here -> https://github.com/Snailedlt/Markdown-Videos

    Edit

    I also made a website to generate the code for you based on the link: https://markdown-videos.jorgenkh.no/