Skip to content

feat(image): support per-image wikilink widths#2751

Open
jcaose wants to merge 2 commits intofolke:mainfrom
jcaose:feat/image-wikilink-width
Open

feat(image): support per-image wikilink widths#2751
jcaose wants to merge 2 commits intofolke:mainfrom
jcaose:feat/image-wikilink-width

Conversation

@jcaose
Copy link

@jcaose jcaose commented Mar 1, 2026

Description

Adds per-image width support for markdown wikilink image previews in snacks.image.

This lets document image previews interpret Obsidian-style wikilink size hints such as:

  • [[image.png|150]]
  • [[image.png|150px]]

The width override is applied per image instance, while height remains automatic to preserve aspect ratio. Global document limits such as image.doc.max_width and image.doc.max_height still clamp the final rendered size.

The implementation moves wikilink option parsing into the markdown image path, propagates width metadata through image matches, and applies it consistently to both inline and hover/floating previews.

During testing, this also required tightening inline placement sizing and placement replacement behavior so repeated edits to the same image size render correctly.

Related Issue(s)

N/A

Screenshots

Suggested screenshots to attach:

  • default wikilink image preview
  • resized wikilink image preview with |150px
  • resized wikilink image preview with |800px
  • same image after removing the size hint, showing it returns to default sizing

@github-actions github-actions bot added docs-vim docs core image size/xl Extra large PR (100+ lines changed) labels Mar 1, 2026
@jcaose jcaose changed the title Feat/image wikilink width feat(image): support per-image wikilink widths Mar 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core docs docs-vim image size/xl Extra large PR (100+ lines changed)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant