mgmeyers / obsidian-contextual-typography

GNU General Public License v3.0
163 stars 9 forks source link

The el-embed-image class does not appear when using Markdown syntax for local images #7

Closed kepano closed 2 years ago

kepano commented 2 years ago

I found an interesting edge case see issue 81 of Minimal Theme

The are three ways to embed images:

  1. ![test](https://test.com/remote.png) (Markdown remote image)
  2. ![[local.png]] (Wikilink local image)
  3. ![test](local.png) (Markdown local image)

When using the third format, .el-embed-image does not appear on the parent container. It works for the other two.

mgmeyers commented 2 years ago

@kepano It turns out this is a bug on obsidian's end. I've added a fix for it in this plugin. Can you update and see if it works for you?

kepano commented 2 years ago

I am testing 2.2.2 and it does seem like Contextual Typography is inserting the correct class but a new bug has cropped up.

If you have more than one image embedded in the following fashion, only the first one displays.

![test](local.png)
![test](local.png)

The second element does not exist at all when using Contextual Typography. Disabling the plugin seems to restore the second element.

mgmeyers commented 2 years ago

Ah, interesting. This should be fixed now. Let me know if you have any other issues with this.

kepano commented 2 years ago

Almost there! I still am running into another condition. If you mix local and remote images the remote ones disappear.

This works

![test](local.png)
![test](local.png)

This works

![test](https://test.com/remote.png)
![test](https://test.com/remote.png)

This doesn't work (the remote one disappears)

![test](https://test.com/remote.png)
![test](local.png)
mgmeyers commented 2 years ago

@kepano I gave it another go, and the plugin should now handle any combination of markdown link embeds + other content. Give it a try and let me know if you run into any other edge cases.

kepano commented 2 years ago

Seems to be working great! Thanks!