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

Possible regression: badge UI pattern in ReStructuredText now fails to render inline images #1801

Open
abravalheri opened this issue Apr 19, 2024 · 1 comment

Comments

@abravalheri
Copy link

It is a common pattern in the Python community to use something similar to the following snippet (in ReStructuredText) to add "badges" as a UI block at the top of the README of repositories:

.. image:: https://img.shields.io/pypi/v/setuptools.svg
   :target: https://pypi.org/project/setuptools

.. image:: https://img.shields.io/pypi/pyversions/setuptools.svg

.. image:: https://github.com/pypa/setuptools/actions/workflows/main.yml/badge.svg
   :target: https://github.com/pypa/setuptools/actions?query=workflow%3A%22tests%22
   :alt: tests

.. image:: https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/charliermarsh/ruff/main/assets/badge/v2.json
    :target: https://github.com/astral-sh/ruff
    :alt: Ruff

.. image:: https://img.shields.io/readthedocs/setuptools/latest.svg
    :target: https://setuptools.pypa.io

.. image:: https://img.shields.io/badge/skeleton-2024-informational
   :target: https://blog.jaraco.com/skeleton

.. image:: https://img.shields.io/codecov/c/github/pypa/setuptools/master.svg?logo=codecov&logoColor=white
   :target: https://codecov.io/gh/pypa/setuptools

.. image:: https://tidelift.com/badges/github/pypa/setuptools?style=flat
   :target: https://tidelift.com/subscription/pkg/pypi-setuptools?utm_source=pypi-setuptools&utm_medium=readme

.. image:: https://img.shields.io/discord/803025117553754132
   :target: https://discord.com/channels/803025117553754132/815945031150993468
   :alt: Discord

Previously, that would render as a horizontal bar:

before

But now each image is occupying a new line:

after

Please note that this was a pattern that historically emerged in the community, so it is wide spread.
Therefore this change affects a lot of repositories, and in my opinion represents a regression.

Examples of repositories affected by this change:

https://github.com/python/cpython/tree/v3.13.0a6
https://github.com/pypa/setuptools/tree/v69.5.1
https://github.com/pyca/cryptography/tree/42.0.5
https://github.com/pytest-dev/pytest/tree/v7.4.3
https://github.com/benjaminp/six/tree/1.16.0
https://github.com/scipy/scipy/tree/v1.13.0
https://github.com/pyscaffold/pyscaffold/tree/v4.5
https://github.com/pyca/pynacl/tree/v0.3.0
https://github.com/jpadilla/pyjwt/tree/2.8.0
https://github.com/jaraco/zipp/tree/v3.18.1
https://github.com/python/importlib_metadata/tree/v7.1.0
https://github.com/python/importlib_resources/tree/v6.4.0
https://github.com/pypa/readme_renderer/tree/43.0

and many more ...

@jwodder
Copy link

jwodder commented Apr 23, 2024

I think what may have happened (and this is partially a guess) is that GitHub is now converting reStructuredText to HTML 5 rather than HTML 4. For whatever reason, Docutils' HTML 4 converter renders a sequence of .. image:: directives as a single paragraph of images, whereas its HTML 5 converter renders each image in a separate paragraph. In order to get multiple images in one paragraph in HTML 5, you need to use substitutions, as currently described in the documentation for the image:: directive.

jshwi added a commit to jshwi/docsig that referenced this issue Apr 28, 2024
jshwi added a commit to jshwi/docsig that referenced this issue Apr 29, 2024
jshwi added a commit to jshwi/docsig that referenced this issue Apr 29, 2024
jshwi added a commit to jshwi/docsig that referenced this issue Apr 29, 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

2 participants