Markup: Image height is ignored in RST

Created on 25 Apr 2014  路  28Comments  路  Source: github/markup

The height option is ignored in RST image directives. For example:

.. image:: https://ci.appveyor.com/api/projects/status/qk0bhyhqp1ekpat8
  :height: 18px

is converted to the following HTML:

<img alt="https://travis-ci.org/cppformat/cppformat.png?branch=master"
src="https://camo.githubusercontent.com/b80618c2de7685ea4a249567a9226130bb238649/68747470733a2f2f7472617669732d63692e6f72672f637070666f726d61742f637070666f726d61742e706e673f6272616e63683d6d6173746572"
data-canonical-src="https://travis-ci.org/cppformat/cppformat.png?branch=master"
style="max-width:100%;">

(note missing height), while rst2html gives the following output:

<img alt="https://ci.appveyor.com/api/projects/status/qk0bhyhqp1ekpat8"
src="https://ci.appveyor.com/api/projects/status/qk0bhyhqp1ekpat8"
style="height: 18px;" />

Most helpful comment

Still waiting for a fix... this feels like those threads under songs with comments like "who listens in 2019?".

Please do consider reopening this extremely tedious and seemingly easily fixable error.

All 28 comments

Image sizes are currently sanitized out. I would love to figure out a solution to the retina issue, per your example. Besides retina images, I haven't seen many compelling use cases for general image sizing.

This is a clear bug and it has nothign to do with the retina. Here is a simple use case for using images of different resolution: you have credits or sponsors for your project and you want do display them. Their logos are of different sizes and you want to make them of similar size. Obviously you do not want to include their logos with your source code due to copyright infringement.

Here is an example of ugly results due to dropping the size elements from the images: https://github.com/pycontribs/jira

Guys, any reason why you "sanitize" the size? I don't really see any good reason for doing this operation, is only making the experience much worse.

Scaling status images for different services like Travis is another common use case. They are often of different sizes.

Seriously? This is mental. It works when for Markdown, but for Python projects it's better to have reStructuredText for the README to avoid having to maintain two README files for GitHub and PyPI. Please reconsider this issue.

This bug as many others are good reasons why people are switching to alternatives, like GitLab. They are open source, more open to suggestions and accepting contributions from the community.

In my case, I'm now shipping a logo in my sources which is really not open source and I'm going to have to remove it again when I do Debian packaging to make sure the package is DFSG compliant. "Sanitising" the heights is really just creating extra work for people. I can see no use case where "sanitising" is useful and no explanation has been given here of why this is the case. I understand GitHub wants to be the definition of open source, and this is good for the GitHub business model, but sometimes it's good to also remember that it exists within an ecosystem and creating extra work for people is a good way to annoy that ecosystem.

+1 for this

Would love it if :width: worked

@bkeepers please reopen the issue.

I have just come across this bug too.
I tried to make the build icons larger in my readme: https://github.com/danieljabailey/tweensvg/blob/master/README.rst
but they are still small.

Please reopen.

+1

+1

Hi all, I've found a workaround using reStructuredText's raw directive. For example:

.. raw:: html

    <img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/Cow_female_black_white.jpg" height="400px">

@jondelmil downside to this approach is pypi. If you end up uploading your project to pypi it will treat your README.rst as plain text and not render it properly.

~4 years later this is still broken on GitHub...

~4 years later this is still broken on GitHub...

Yeah, to be honest I wouldn't even use RST if it wasn't for a few python projects I happen to maintain, and not wanting to duplicate README.md and README.rst. lol

What's particularly annoying is that it's broken intentionally:

Image sizes are currently sanitized out.

See #1162 for the open ticket of this bug that won't fix.

Yeah, to be honest I wouldn't even use RST if it wasn't for a few python projects I happen to maintain, and not wanting to duplicate README.md and README.rst. lol

Good news! There's now no need to be stuck with RST for Python! The new PyPI (aka Warehouse) supports Markdown!

More info and examples:

What the hell? Not even scaling down the images works. They are still scaled up to full page width by GitHub (and look even worse due to lower resolution). Please reopen this issue.

?! Apparently, the images do get smaller as soon as you are below a certain limit.

?! Apparently, the images do get smaller as soon as you are below a certain limit.

Would love to hear further details on this.

Why close it? The problem still exist

If you end up uploading your project to pypi it will treat your README.rst as plain text and not render it properly.

@retr0h could you just set long_description_content_type="text/x-rst" in your setup.py, so that PyPI renders it correctly? I haven't tried it with raw but that might work so you at least don't have duplicate readme's

Still waiting for a fix... this feels like those threads under songs with comments like "who listens in 2019?".

Please do consider reopening this extremely tedious and seemingly easily fixable error.

Having this closed/wontfix makes rST a 2nd-class citizen on GitHub. Transitively, that gives the same impression for projects which prefer rST, like Python.

Reopen this

Was this page helpful?
0 / 5 - 0 ratings