markdown_articles_tool icon indicating copy to clipboard operation
markdown_articles_tool copied to clipboard

Image download is skipped when using md image size syntax

Open Quentin50 opened this issue 1 year ago • 3 comments

Hello

Following the 0.1.2 update, I have noticed that some images were not downloaded. It comes from the fact that in Markdown, you can specify an image width or height by adding " =WIDTHxHEIGHT". But when trying to download the image, the tool includes this information in the image URL. For instance, if a markdown file contains

My avatar scaled to 300 pixels width: ![](https://avatars.githubusercontent.com/u/32387838 =300x)

the tool will try to download the image at

https://avatars.githubusercontent.com/u/32387838 =300x

which is an invalid URL. Thus, the error message for unrecognized MIME type will be printed, and the download will be skipped.

Notes:

  • This syntax is not recognized by every md parser, but it works on CodiMD.
  • A link may still be valid if a query is used in the URL, as =300x will be considered a parameter. For example, https://avatars.githubusercontent.com/u/32387838?s=80&v=4 =300x is a valid URL
  • I found ths syntax described in this StackOverflow answer: https://stackoverflow.com/a/21242579

Quentin50 avatar Oct 10 '22 07:10 Quentin50

Wow. Is it syntax standard for Markdown? Previously, I did not pay attention to such things...

artiomn avatar Oct 13 '22 00:10 artiomn

This is supported by the several editors...

artiomn avatar Oct 13 '22 00:10 artiomn

Ok, I'll try to support this.

artiomn avatar Oct 13 '22 00:10 artiomn