readme-renderer is a Python library designed to safely convert README file content (Markdown, reStructuredText, or plain text) into HTML. It is primarily used by PyPI's Warehouse to render `long_description` for Python packages, ensuring they display correctly and securely on the PyPI website. The library is currently at version 44.0 and is actively maintained by the Python Packaging Authority (PyPA).
pip install readme-rendererVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to render both Markdown and reStructuredText content into HTML using the `readme_renderer` library. It imports the specific rendering functions from their respective submodules and then calls them with sample content. The output is a string of HTML. Note that for Markdown rendering, the optional `cmarkgfm` dependency is highly recommended, installed via `pip install readme-renderer[md]`.
Update `pip install` commands and Python import statements from `readme` to `readme_renderer`.
Install the library with the Markdown extra: `pip install readme-renderer[md]`.
Upgrade Python to 3.8 or newer. The current version (44.0) requires Python >=3.9.
Validate reStructuredText carefully, for example, by using `twine check dist/*` on your built distributions, and avoid Sphinx-specific extensions.
Review the allowed HTML tags if embedding HTML directly in your README. Generally, rely on Markdown or reStructuredText syntax for formatting rather than raw HTML.
pip install readme-renderer
Reduce the size of your README file by simplifying content, removing large images, or optimizing its structure to stay within PyPI's limits.
Ensure that all files referenced by `.. include::` directives exist and are correctly located relative to your README.rst file.
Use standard reStructuredText syntax or directives supported by `docutils`, or switch to Markdown if advanced formatting is essential and Sphinx is not being used for rendering.