How to extract all images from a markdown file?

The aim is to extract all images from a markdown file in Obsidan.

My try:

  1. write regex to match: but it’s impossible to include everything
  2. use document.querySelector('img'): but it can’t get all images in Obisidan (it may cause from Obsidian cache mechanism)

My idea:

  1. get a markdown file content
  2. convert or render markdown to HTML: all images will be rendered into img tag, like <img name ='' src=''>, in that way all images will be rendered in an unified way, so it’s easy to extract all images

Please help me out! Thx~~~

1 Like

+1 waiting…

Please don’t do that — thanks.