-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please implement a simple way to specify image sizes in markdown #21473
Comments
|
Thanks, I see, I moved here: yuin/goldmark#331 |
or what it's worth, GitLab is adding this now: https://gitlab.com/gitlab-org/gitlab/-/issues/15697#note_1188752984 Sadly, in goldmark the request hasn't gotten any reaction. That this is possible via hacky, ugly HTML I already addressed in the opening post - yeah, it "works" but it's pretty hostile to newcomers wanting to jump in and help out the project documentation who are unfamiliar with HTML. That it's longer isn't the problem, the problem is the assumption/requirement that anyone wanting to contribute to the docs needs to be familiar with HTML. HTML is not a naturally quick thing to learn for non-coders who may want to contribute. |
I know, but I also think there is a reason why Markdown chose to include (a subset of ?) HTML for anything advanced: |
I mean, Markdown already has everything needed for 99% of projects to never touch HTML - except for image sizes. Hence this issue. Image bounds are not very specific, as soon as you have any higher DPI screenshots you just really need them or all the images will display as way too giant for everyone and make the documentation unreadable. And in the age of phone apps and High-DPI laptop screens, a lot of projects will have High-DPI images simply for their official screenshots, so that's not a rare or particularly specific need. I think the goal should be that the average, simpler project doesn't need to use inline HTML. And it's already almost there, anyway. |
Feature Description
Please specify a simple way to specify image sizes in markdown. This is needed when using High-DPI images in documentation without making tons of low DPI manually scaled copies which kind of goes against the spirit of easy markdown documentation (which IMHO is to not spend hours in some other programs making a complicated baked altered layouted document, but just writing a simple semantic document with minimal markup and done).
Most common syntax (Pandoc extension):
![](https://try.gitea.io/assets/img/logo.svg){width=200}
![](https://try.gitea.io/assets/img/logo.svg){width=200px height=200px}
It's specified here: https://pandoc.org/MANUAL.html#extension-link_attributes and proposed by CommonMark community members in a discussion here: https://talk.commonmark.org/t/support-for-image-dimensions/148/45
Second most common syntax (found in discussions etc.):
![](https://try.gitea.io/assets/img/logo.svg =200x100}
(for width 200px, height 100px)![](https://try.gitea.io/assets/img/logo.svg =200x}
(for width 200px, height unspecified)![](https://try.gitea.io/assets/img/logo.svg =x100}
(for height 100px, width unspecified)What currently works:
This works on Gitea right now, the above stuff doesn't:
<img src="https://try.gitea.io/assets/img/logo.svg" width=100px/>
(can even be nested into markdown links:
[<img src="https://try.gitea.io/assets/img/logo.svg" width=100px/>](https://gitea.io)
)How to support it?
I think best would be to support both the most common and 2nd most common way. Could be done as a pre-parser that just looks for images and reformats them to "what currently works" before passing on the reformatted markdown to whatever regular library you use for the rest.
Screenshots
No response
The text was updated successfully, but these errors were encountered: