8000 Add styles for rST admonitions · Issue #8300 · pypi/warehouse · GitHub 8000
[go: up one dir, main page]

Skip to content
Add styles for rST admonitions #8300
@jwodder

Description

@jwodder

reStructuredText includes a number of admonition directives that should be typically rendered "as an offset block in a document, sometimes outlined or shaded"; however, Warehouse currently does no special styling of admonitions in project descriptions, having them instead show up as just plain text, with even the admonition title being just an unstyled paragraph.

This is partially readme_renderer's fault, as its cleaning postprocessing routines strip the "admonition" and [admonition name] classes from the rendered admonition <div> and strip the "admonition-title" class from the title <p>, so it will need to be patched in addition to Warehouse adding the necessary styles.

For comparison, the following markup:

This text comes before any admonitions.

.. note::

    This is a note.

.. warning::

    Danger, danger, Will Robinson!

.. admonition:: Generic

    This is a generic admonition.

This text comes after the admonitions.

is currently rendered as follows on Warehouse:

pypi

Converting the markup to HTML with Docutils' rst2html4.py (using the builtin default stylesheets) produces this rendering:

docutils

Converting the markup to HTML using Sphinx and the sphinx_rtd_theme theme produces:

sphinx-rtd

(Sadly, GitHub currently does not style admonitions either, so I don't have an example from them.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0