Feature: image sizes
See original GitHub issueRight now library doesn’t support custom sizing of images. But it would be a good thing to support it.
There is no standard about image sizes in markdown. But as markdown supports inline HTML, library might be parsing HTML arguments specified in <img>
tag:
width=
height=
style="width: ; height: ;"
Another thing is what measure units to support. I suggest using:
%
percentpx
pixels (all other unitspt
,em
defaults to pixels). And pixels should be treated asdp
on Android
Issue Analytics
- State:
- Created 6 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
How to Change Your Featured Image Size in WordPress
A good starting point for your WordPress featured image size is 1200 x 628 pixels. These dimensions tend to work well across WordPress...
Read more >Best WordPress Featured Image Size & Best Practices
While different themes have different featured image sizes, we recommend going with an image size of 1200 pixels by 628 pixels if you...
Read more >How To Set The WordPress Featured Image Size - WPkind
Step 2 – Edit the WordPress featured image dimensions ; large, ; medium or ; thumbnail image sizes, you can change the corresponding...
Read more >How To Change WordPress Featured Image Size in 2022?
The most recommended or ideal WordPress feature image size is 1200 by 628 pixels. This is one of the most common and widely...
Read more >Change the Featured Image Size in WordPress
These properly named sizes are: Thumbnail (150px), Medium (300px), Medium Large (768px), and Large (1024px). Two more variants with 1536px and ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello @liweijian ,
there are multiple options to support images sizes now.
For example commonmark-java currently has an extension to specify width and height for an image - via
![alt](#){width=10 height=19}
syntax. They had it implemented as a delimiter processor, but unfortunately these attributes are available for HTML rendering only. We could adopt similar solution.Then, currently commonmark allows specifying title for an image with
![alt](# "title")
syntax. So, for example![IMAGE](quiver-image-url/CE441C33AC43C93AA252DD42A1E73DB9.jpg "=618x164")
would be a relatively easy addition. Not sure if it is a good application for title, but still it is a possibility.And finally, a custom inline processor could be implemented. It would require quite a few changes. You can inspect code in CloseBracketInlineProcessor class. I would not modify it directly as it would diverge
Markwon
andcommonmark-java
code bases, which is not a very welcome thing at this point. Anyway, if you feel like it, you can fork this class and adjust to your needs.PS I should also mention that there is another way for specifying image size - HTML.
markwon-html
artifact supportswidth
andheight
attributes from day 1Hello @ubuntudroid ,
I can confirm that this happens. Image loader would be asked to prepare image resource and after that
ImageSizeResolver
would do a final post processing. For example, whenwidth=100%
then it would scale the image (up or down depending on its original size). Another use-case is when image exceeds available width and will be scaled down to fit. A possible fix is to do resizing inside image loader itself (maybe the only one given the current state of things)