Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image height is ignored in RST #295

Closed
vitaut opened this issue Apr 25, 2014 · 30 comments
Closed

Image height is ignored in RST #295

vitaut opened this issue Apr 25, 2014 · 30 comments

Comments

@vitaut
Copy link

vitaut commented Apr 25, 2014

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;" />
@bkeepers
Copy link
Contributor

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.

@ssbarnea
Copy link

ssbarnea commented Apr 1, 2015

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

manuroe added a commit to matrix-org/matrix-ios-kit that referenced this issue Apr 20, 2015
@ssbarnea
Copy link

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.

@vitaut
Copy link
Author

vitaut commented Feb 18, 2016

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

@irl
Copy link

irl commented Oct 21, 2016

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.

irl added a commit to mami-project/pathspider that referenced this issue Oct 21, 2016
irl added a commit to mami-project/pathspider that referenced this issue Oct 21, 2016
@ssbarnea
Copy link

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.

@irl
Copy link

irl commented Oct 22, 2016

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.

keishinkickback added a commit to keishinkickback/notifycenter-python that referenced this issue Oct 28, 2016
Github sanitizes out image size option
github/markup#295
asqui added a commit to pycontribs/jira that referenced this issue Nov 15, 2016
Since GitHub reStructuredText doesn't respect image sizing parameters
(see github/markup#295) leverage this
on-the-fly resizing service that someone sniffed out from Google.
(see https://gist.github.com/carlo/5379498)

Only downside is that I don't think it's officially supported,
so might go away at any time, but it's better than giant logos!
ssbarnea pushed a commit to pycontribs/jira that referenced this issue Nov 21, 2016
Since GitHub reStructuredText doesn't respect image sizing parameters
(see github/markup#295) leverage this
on-the-fly resizing service that someone sniffed out from Google.
(see https://gist.github.com/carlo/5379498)

Only downside is that I don't think it's officially supported,
so might go away at any time, but it's better than giant logos!
ssbarnea pushed a commit to pycontribs/jira that referenced this issue Jan 9, 2017
Since GitHub reStructuredText doesn't respect image sizing parameters
(see github/markup#295) leverage this
on-the-fly resizing service that someone sniffed out from Google.
(see https://gist.github.com/carlo/5379498)

Only downside is that I don't think it's officially supported,
so might go away at any time, but it's better than giant logos!
@alainbryden
Copy link

+1 for this

@aclark4life
Copy link

Would love it if :width: worked

marcoskirsch added a commit to ni/nimi-python that referenced this issue Aug 16, 2017
marcoskirsch added a commit to ni/nimi-python that referenced this issue Aug 16, 2017
* Several updates and fixes.

* add image

* options for image

* absolute path for image URI

* Reduce image size, add height/width to RST

* Fix dimensions

* Move image info to bottom

* move back image to top

* Make image smaller since width attribute is sanitized.

Works around github/markup#295
@vi3k6i5
Copy link

vi3k6i5 commented Sep 12, 2017

@bkeepers please reopen the issue.

@lexbailey
Copy link

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.

@brooksandrew
Copy link

+1

1 similar comment
@same-id
Copy link

same-id commented Oct 28, 2017

+1

@jmillxyz
Copy link

jmillxyz commented Nov 2, 2017

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">

JulienPeloton pushed a commit to JulienPeloton/s4cmb that referenced this issue Nov 8, 2017
@retr0h
Copy link

retr0h commented Feb 9, 2018

@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.

@vitaut
Copy link
Author

vitaut commented Feb 9, 2018

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

@LucaCappelletti94
Copy link

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.

sbrugman added a commit to dylan-profiler/visions that referenced this issue Jan 29, 2020
ihnorton added a commit to TileDB-Inc/TileDB-Py that referenced this issue Mar 9, 2020
Github's RST rendering is currently broken [1]: does not support image sizing or multiple images per line.
PyPI now supports markdown, so we can switch to harmonize with TileDB
core repo.

[1] github/markup#295
ihnorton added a commit to TileDB-Inc/TileDB-Py that referenced this issue Mar 9, 2020
Github's RST rendering is currently broken [1]: does not support image sizing or multiple images per line.
PyPI now supports markdown, so we can switch to harmonize with TileDB
core repo.

[1] github/markup#295
ihnorton added a commit to TileDB-Inc/TileDB-Py that referenced this issue Mar 9, 2020
Github's RST rendering is currently broken [1]: does not support image sizing or multiple images per line.
PyPI now supports markdown, so we can switch to harmonize with TileDB
core repo.

[1] github/markup#295
ihnorton added a commit to TileDB-Inc/TileDB-Py that referenced this issue Mar 9, 2020
Github's RST rendering is currently broken [1]: does not support image sizing or multiple images per line.
PyPI now supports markdown, so we can switch to harmonize with TileDB
core repo.

[1] github/markup#295
kratsg pushed a commit to scikit-hep/pyhf that referenced this issue Apr 21, 2020
* Remove use of raw directive in README.rst as not allowed on PyPI
   - Amends PR #819
* Resize image files for Brazil Band plots in README to be 500 px wide
   - c.f. github/markup#295
* Add twine check of dist to publishing CI tests
* Add smaller version of pyhf logo for documentation
@selik
Copy link

selik commented May 19, 2020

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.

cwmeijer added a commit to matchms/matchms that referenced this issue May 25, 2020
Also removed matchms header, as the logo IS the header. 
Because image height is ignored by github while rendering rst (github/markup#295 from 2014), I'm using raw html to get the logo the size that I want.
@Zethson
Copy link

Zethson commented Jun 4, 2020

Please reopen this.

ericpre added a commit to ericpre/start_jupyter_cm that referenced this issue Jun 24, 2020
antalakas pushed a commit to TileDB-Inc/TileDB-Py that referenced this issue Jul 6, 2020
Github's RST rendering is currently broken [1]: does not support image sizing or multiple images per line.
PyPI now supports markdown, so we can switch to harmonize with TileDB
core repo.

[1] github/markup#295
bobheadxi added a commit to ubclaunchpad/rocket2 that referenced this issue Sep 29, 2020
Turn big rocket to small rocket when rendered in GitHub. We use raw HTML image element because GitHub has no plans to support RST image widths (github/markup#295), and in that element we use a remote link instead of a relative one because it seems Sphinx does not handle relative links very well outside of proper RST images.
bradcray added a commit to bradcray/chapel that referenced this issue Nov 17, 2020
inspired by github/markup#295 (comment)

---
Signed-off-by: Brad Chamberlain <bradcray@users.noreply.github.com>
bocklund added a commit to bocklund/ESPEI that referenced this issue Jan 8, 2021
bocklund added a commit to PhasesResearchLab/ESPEI that referenced this issue Jan 8, 2021
GitHub sanitizes the size of figures in their RST renderer (see github/markup#295), so we need to remove the logo (the workaround suggested in that issue of using the RST `raw` directive doesn't work because PyPI rejects the `raw` directive).
@brasic
Copy link
Contributor

brasic commented Sep 2, 2021

Just a heads up: width and height attributes are now permitted in RST images.

OleksandrAnisimo added a commit to OleksandrAnisimo/flask-multipass that referenced this issue Apr 20, 2024
OleksandrAnisimo added a commit to OleksandrAnisimo/flask-multipass that referenced this issue Apr 20, 2024
@AndydeCleyre
Copy link

Just a heads up: width and height attributes are now permitted in RST images.

Is this working for other folks? It doesn't seem to work still. Does it matter that I am specifying percents for width?

AndydeCleyre added a commit to AndydeCleyre/zpy that referenced this issue Apr 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests