russross / blackfriday

Blackfriday: a markdown processor for Go
Other
5.44k stars 600 forks source link

Add syntax to enable image resizing #265

Open flexd opened 8 years ago

flexd commented 8 years ago

Something like ![some image](http://google.com/someurl 500x400) resulting in HTML <img src="http://google.com/someurl" width=500 height=200/> would be great to have. I know it's better to resize images before you publish, but sometimes it's nice to be able to do this without needing to use HTML code.

dmitshur commented 8 years ago

@flexd asked me on Gophers Slack about this issue:

hey, saw you had looked at the blackfriday code a bit, do you think this would be hard to implement?

I think the implementation difficulty is medium (it's not trivial, and it's not extremely difficult).

However, in order to implement this, it requires changing the Markdown spec (for some loose meaning of "spec"). I'm not sure what to say about that.

I think the way people commonly solve this need is by using HTML in their Markdown:

<img src="http://google.com/someurl" width=500 height=200 />

E.g., see first 3 lines of https://raw.githubusercontent.com/gopherjs/vecty/28c3a9d017d42bfb5231cfa9ff/README.md and the result at https://github.com/gopherjs/vecty/blob/28c3a9d017d42bfb5231cfa9ff/README.md.

flexd commented 8 years ago

Yeah I figured HTML is the easiest way of doing so. I know that a few other markdown processors implement a syntax similar to what I suggested. I guess it's up to the project if they want to include some functionality or stick to the spec.