reStructuredText for Python Documentation
Convert Markdown to RST for Sphinx and Python projects
Convert to RSTreStructuredText (RST) is the standard documentation format for Python projects using Sphinx. While Markdown is great for writing, RST offers powerful features for technical documentation. By converting Markdown to RST, you can write quickly in Markdown and integrate with existing Python documentation workflows.
Why Convert to RST?
- Sphinx compatibility - RST is Sphinx's native format
- Python ecosystem - Most Python docs use RST
- Cross-references - RST supports robust linking between documents
- Extensions - Access Sphinx's powerful extension ecosystem
- Read the Docs - Direct integration with RTD hosting
How It Works
When you convert Markdown to RST, you get proper RST syntax:
Introduction
============
This is a paragraph with **bold** and *italic* text.
* First item
* Second item
Code Example
------------
.. code-block:: python
def greet(name):
return f"Hello, {name}!"Markdown to RST Mapping
| Markdown | RST Output |
|---|---|
# Heading | Underlined with ===== |
## Subheading | Underlined with ----- |
**bold** | **bold** |
*italic* | *italic* |
`code` | ``code`` |
[text](url) | `text <url>`_ |
| Code blocks | .. code-block:: |
Using RST with Sphinx
Basic Workflow
- Write content in Markdown for speed
- Convert to RST using Markdown2ANY
- Add RST-specific features (directives, cross-references)
- Build with Sphinx:
sphinx-build -b html source/ build/
Adding RST Features
After conversion, enhance your RST with Sphinx directives:
.. note::
This is a note admonition.
.. warning::
This is a warning.
.. seealso::
:doc:`other-document`Common Use Cases
API Documentation
Convert README files and guides to RST to integrate with autodoc-generated API references.
Tutorials
Write tutorials in Markdown, convert to RST, then add cross-references to API documentation.
Contributing Guides
Create contributor documentation that matches the rest of your project's docs format.
RST-Specific Features
After conversion, you can add RST features Markdown doesn't support:
- Admonitions - Note, warning, tip, danger boxes
- Cross-references - Link between documents and sections
- Roles - Semantic markup like
:func:,:class: - Directives - Custom content blocks
- Toctrees - Document hierarchies
Related Guides
- Markdown for Software Documentation - Documentation best practices
- Markdown Basics Guide - Learn Markdown syntax
- Choosing the Right Output Format - Compare all formats