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 alignment not respected in reStructuredText #163

Closed
jkleint opened this issue Nov 3, 2012 · 22 comments · May be fixed by #1222
Closed

Image alignment not respected in reStructuredText #163

jkleint opened this issue Nov 3, 2012 · 22 comments · May be fixed by #1222

Comments

@jkleint
Copy link

jkleint commented Nov 3, 2012

If I try to right-align an image in reStructuredText:

.. image:: https://travis-ci.org/jkleint/blamethrower.png
  :align: right

It comes out left-aligned: https://github.com/jkleint/blamethrower/blob/master/README.rst

@jone
Copy link

jone commented Jan 3, 2013

python-creole, which seems to be used for rest2html, does not support it at the moment.
I've made a fix & pull-request to jedie/python-creole#11 for fixing it.

@jedie
Copy link

jedie commented Jan 3, 2013

python-creole is IMHO not used here. See: https://github.com/github/markup/blob/master/lib/github/commands/rest2html

@jone
Copy link

jone commented Jan 3, 2013

oh, my bad. I assumed it is used here.
I'm gonna look into it.

@gjtorikian
Copy link
Contributor

@flying-sheep
Copy link
Contributor

This bug is not fixed, :align: right has no impact on the emitted HTML, which is wrong. please reopen

@bmorris3
Copy link

I think this is still an issue. Any help?

@Gallaecio
Copy link

Gallaecio commented Sep 16, 2020

Align is deprecated in HTML5: http://stackoverflow.com/questions/14551305/align-attribute-deprecated

@gjtorikian reStructuredText’s align is not HTML, is reStructuredText syntax. And it is not deprecated (emphasis mine):

The alignment of the image, equivalent to the HTML tag's deprecated "align" attribute or the corresponding "vertical-align" and "text-align" CSS properties. The values "top", "middle", and "bottom" control an image's vertical alignment (relative to the text baseline); they are only useful for inline images (substitutions). The values "left", "center", and "right" control an image's horizontal alignment, allowing the image to float and have the text flow around it. The specific behavior depends upon the browser or rendering software used.

@gjtorikian
Copy link
Contributor

I don’t work at GitHub anymore, please contact their support.

@Gallaecio
Copy link

@kivikakk Any chance you could reopen this issue?

@flying-sheep
Copy link
Contributor

flying-sheep commented Sep 16, 2020

#1222 is an old attempt by me to fix this, and I assume it didn’t fix this because of gjtorikian/html-pipeline#302. Not entirely sure if that’s still the case.

We just need someone at GitHub to start caring at some point.

@kivikakk
Copy link
Contributor

I also don't work at GitHub anymore, sorry; contacting support remains your best option.

@Gallaecio
Copy link

@kivikakk Sorry, I saw your commits were the most recent, I did not realize they were from more than 1 year ago.

I wonder if GitHub is even maintaining this anymore.

@Gallaecio
Copy link

@aharpole Could we reopen this issue?

@StefanBogdan
Copy link

I am experiencing the same problem. The README.rst does not take into account the :align: or :width: for me. But if I use the same README.rst as a long description for PyPI it is rendered exactly as I want. I think this should be reopened too.

@trevorld
Copy link

In case people aren't aware of this workaround note Github does however respect align="right" within an html <img> tag contained within a restructuredText raw:: html directive e.g.

.. raw:: html

   <img src="figures/logo.png" align="right" width="300px" alt="right-aligned logo in README">

does work even if the equivalent rst image directive unfortunately does not:

.. image:: figures/logo.png
  :align: right
  :width: 300
  :alt: right-aligned logo in README

@bmorris3
Copy link

The align feature in rst seems to be working now! See example here.

@waldyrious
Copy link

The align feature in rst seems to be working now! See example here.

At last! I assume this was fixed by #1452.

@jmi2k
Copy link

jmi2k commented Nov 17, 2022

The align feature in rst seems to be working now! See example here.

It doesn't work for me using a PNG file, either a local one or an URL.

@flying-sheep
Copy link
Contributor

Does work for us: https://github.com/scverse/anndata#readme

It's a SVG, but I'm unsure how this could be relevant.

@Gallaecio
Copy link

Gallaecio commented Nov 19, 2022

Both the linked examples work on my browsers (latest Firefox, latest Chromium).

Captura de pantalla o 2022-11-19 ás 13 32 20
Captura de pantalla o 2022-11-19 ás 13 32 06

@jmi2k
Copy link

jmi2k commented Nov 19, 2022

Here you have a gist showcasing both cases https://gist.github.com/jmi2k/f422df7d4a67dde9c19e74d091c3582e.

@Gallaecio
Copy link

Here you have a gist showcasing both cases https://gist.github.com/jmi2k/f422df7d4a67dde9c19e74d091c3582e.

Interesting, the PNG one does not seem to get align="right" there.

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

Successfully merging a pull request may close this issue.