presenterm icon indicating copy to clipboard operation
presenterm copied to clipboard

Allow wikilinks for image embedding

Open 0atman opened this issue 10 months ago • 3 comments

(discussion started in #448, where wikilink support was added)

✅ Markdown links can embed images:

![image:width:20%](fido.jpg)

❌ But wikilinks do not yet support this:

![[fido.jpg|image:width:20%]]

Prior Art

A very related project is the Advanced Slides plugin for Obsidian (750k downloads), which handles image embedding and resizing like this:

Insert image with obsidian markdown syntax

![[Image.jpg]]

---

Scale image to a width of 100 px

![[Image.jpg|100]]
![Image|100](https://picsum.photos/id/1006/500/300)

I propose if possible, compatibility with this syntax would be a great option (if not default).

Thoughts

While comrak does have a wikilink extension, it doesn't appear to support embedding those links. it is notable that there are no examples of ![[]] links in their test suite.

Notes

0atman avatar Feb 12 '25 15:02 0atman

Like I mentioned in the other issue, I think this should be comrak's responsibility. It doesn't make sense that presenterm has to parse an already parsed markdown even further, plus comrak already should have the tools/primitives to parse this. I would imagine doing this work in comrak would yield the same Image node type they emit for the normal ![]() image tags so it would work here without any changes.

mfontanini avatar Feb 12 '25 16:02 mfontanini

Totally agreed, I'll use this issue to track my progress over there 👌

0atman avatar Feb 13 '25 12:02 0atman

tracking upstream issue https://github.com/kivikakk/comrak/issues/535

0atman avatar Feb 13 '25 12:02 0atman