Skip to main content

A plugin for Python-Markdown that allows you to embed media files as in Obsidian.

Project description

Obsidian media embedder

Made by Ukrainian 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:

  • Images: avif, bmp, gif, jpeg, jpg, png, svg, webp.
  • Audio: mp3, wav, m4a, ogg, 3gp, flac.
  • Video: mp4, webm, ogv, mov, mkv.
  • Other: md, pdf not yet.

And even more than that! It embeds youtube videos too!

![](https://youtu.be/dQw4w9WgXcQ)

Usage

Simply enable the extension like this:

import markdown

md = markdown.Markdown(extensions=['obsidian_media'])
print(md.convertFile('page.md'))

MkDocs

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]]

Credits

This extension is heavily inspired by orobardet/pymarkdown-video and motivated by @pipe-organ in GooRoo/mkdocs-obsidian-bridge#17.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

obsidian_media-2.0.0.tar.gz (11.3 kB view hashes)

Uploaded Source

Built Distribution

obsidian_media-2.0.0-py3-none-any.whl (6.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page