How to work html code in markdown code?

"I need to explain why in the following code:

<img src='images/mtg-barvy.png'>

![image](images/mtg-barvy.png)

The first one doesn’t work and shows a non-existing image, while the second one works and displays the image. How should the img tag be written to display images stored in a subdirectory?"

On macOS this works:

<img src="file:///Users/USER/Desktop/monthly-cal.png" />

and an image within my Obsidian vault:

<img src="file:///Users/USER/Obsidian/VAULT/00 meta/01 assets/3D.png" />

This is an absolute path, completely unusable for me for two reasons.

  1. I have hundreds of md files, I need them to work as they are.
  2. I share my md files via Dropbox between multiple devices, including Windows and Android, each has a different absolute path.

When I discovered Obsidian, I really liked it, but now that I am trying to use it, it seems to be more and more of a joke. Displaying images is an absolute basic. How can Obsidian users accept this? Isn’t it unusable for serious use?

Might I ask why you need to use the <img>?

I know markdown isn’t really written designed for images, but which features are you missing from the markdown variants for including images?

The point I’m trying to make is that it might be a better option to explore the possibilities of markdown with plugins and other extensions, rather than trying to make a markdown editor into an HTML editor/browser.

2 Likes

I was just offering an option that I knew of.

Out of my thousands of notes, there are only a handful with HTML mixed in - most of them examples like the above of how to use HTML mixed with Markdown. I use a Markdown editor to keep HTML out of my notes. :v:

For many users, including those with serious uses, basic image handling is enough.

There may be a feature request to make relative paths work in HTML that you could upvote.

“As I mentioned earlier, I have hundreds of notes that use this, and Obsidian is the only markdown viewer that can’t display them. I don’t understand your comment. I’m surprised that a markdown editor can’t display a standard markdown document. HTML is part of the CommonMark specification: CommonMark Spec

“And what would be the point of that? There are already many requests for this feature, some even two years old. Including claims that they can’t switch to Obsidian without this basic functionality.”

A Markdown editor should support the <img> element for several reasons:

  1. Universality: Markdown is popular for its simplicity and universality. Many documents require the inclusion of images, and the <img> element is a fundamental tool for this purpose.

  2. Compatibility: A lot of markdown documents contain images. If an editor does not support the <img> tag, its compatibility with these documents is limited.

  3. Visual Presentation: Images are often essential for understanding context or complex topics. Without shows embed images, many documents would be incomplete or less comprehensible.

  4. HTML in Markdown: Since Markdown supports HTML, it’s logical for the editor to support basic HTML tags, including <img>.

Obsidian’s team is small and there are hundreds of feature requests, and many would feel just as strongly about some of them.

If there are multiple posts in Feature requests for this, you can increase their chances by pointing them out as duplicates so we can merge them into a single one showing all the support (you can use the flag feature in the menu at the bottom of the post for this). Consider the oldest one to be the original and newer ones to be duplicates.

You could also copy the list you wrote into a comment on one of them, where it will have more impact.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.