Embed media files in markdown as in Obsidian
BSD-3-CLAUSE License
This is an extension for Python-Markdown which allows you to embed audio or video files as easily as images by simply writing:
![my song](assets/music/my-last-song.mp3)
![my video](assets/video/interview.webm)
Additionally, this plugins allows to specify an image size the Obsidian way, e.g.:
![400x300](assets/images/photo.jpg) <!-- width and height -->
![400](assets/images/photo.jpg) <!-- only width -->
Supported formats are:
avif
, bmp
, gif
, jpeg
, jpg
, png
, svg
, webp
.mp3
, wav
, m4a
, ogg
, 3gp
, flac
.mp4
, webm
, ogv
, mov
, mkv
.md
, pdf
And even more than that! It embeds youtube videos too!
![](https://youtu.be/dQw4w9WgXcQ)
Simply enable the extension like this:
import markdown
md = markdown.Markdown(extensions=['obsidian_media'])
print(md.convertFile('page.md'))
It can be used with MkDocs as following:
# mkdocs.yml
markdown_extensions:
- obsidian_media_mkdocs
For the best results, I recommend using it together with my mkdocs-obsidian-bridge. This would allow you to simply write:
![[assets/audio/my favourite song.mp3]]
![[assets/video/birthday party.mov]]
![[images/photo.jpg|400x300]]
![[images/photo.jpg|200]]
This extension is heavily inspired by orobardet/pymarkdown-video and motivated by @pipe-organ in GooRoo/mkdocs-obsidian-bridge#17.