Skip to content

Add md attribute to set image width#123

Merged
markotoplak merged 1 commit into
biolab:mainfrom
janezd:img-width
Dec 19, 2025
Merged

Add md attribute to set image width#123
markotoplak merged 1 commit into
biolab:mainfrom
janezd:img-width

Conversation

@janezd
Copy link
Copy Markdown
Contributor

@janezd janezd commented Jul 11, 2025

This PR allows to set the width for images in documentation for widgets, e.g.

![](/widget-catalog/data/images/SQLTable-stamped.png){width="70%"}

or

![](/widget-catalog/data/images/Datasets-stamped.png){width="300"}

This syntax is used because it is supported by myst, which we use as a sphinx plugin for building the docs.

A regex is used to replace the above with ![](/widget-catalog/data/images/Datasets-stamped.png)<!--rehype:width="300"-->, which is a syntax handled by the rehype-attr plugin. I would prefer using remark-attr that supports myst's syntax directly, but remark-attr hasn't been touched since 2020 and no longer works. An alternative would be to reimplement remart-attr on our own ... but this approach is simpler.

Furthermore, the PR modifies getImageData to respect the manually set width (and scale the height correspondingly).

@vercel
Copy link
Copy Markdown

vercel Bot commented Jul 11, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
orange-web2 ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 11, 2025 5:12pm

@vercel
Copy link
Copy Markdown

vercel Bot commented Dec 19, 2025

@markotoplak is attempting to deploy a commit to the biolab Team on Vercel.

A member of the Team first needs to authorize it.

@markotoplak markotoplak force-pushed the img-width branch 3 times, most recently from 3d49484 to ba58ae6 Compare December 19, 2025 09:28
@markotoplak
Copy link
Copy Markdown
Member

Janez, thanks for the PR you probably forgot about. :)

@markotoplak markotoplak merged commit 3ccfa83 into biolab:main Dec 19, 2025
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants