Replies: 2 comments 4 replies
-
For what it's worth, GitLab appears to be adding this now: https://gitlab.com/gitlab-org/gitlab/-/issues/15697#note_1188752984 |
Beta Was this translation helpful? Give feedback.
0 replies
-
You probably can implement an extension like https://github.com/mdigger/goldmark-attributes for images. |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
(Forwarded from go-gitea/gitea#21473 )
I would suggest to add in 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 with duplicated baked images, but just writing a simple semantic document with minimal markup and done).
Most common syntax (To be added to GitLab, 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)
)However, this is not particularly intuitive and just sticks out terribly.
How to support it?
I think best would be to support both the most common and 2nd most common way as an optional switch. This way the library users who don't want it can opt out, hopefully nobody will complain about "polluting the standard", and it's available for those who want to give their users a nicer experience.
The main use case I really see in documentation. Inline HTML is just so clumsy, and markdown for documentation is otherwise just so perfectly clean and simple. And while I understand layouting and sizes and other presentation concerns are usually kept out of markdown, for images that's not really possible (due to the DPI issues) so it'd be nice to have a clean solution to specify the proper size without those HTML hacks.
Beta Was this translation helpful? Give feedback.
All reactions