rst2gfm - reStructuredText to GitHub Flavored Markdown Converter
A Python tool that converts reStructuredText (RST) documents to GitHub Flavored Markdown (GFM).
Features
- Converts RST documents to GitHub Flavored Markdown
- Preserves document structure including headings, paragraphs, and formatting
- Supports common RST elements:
- Headers/sections
- Text formatting (bold, italic)
- Code blocks with language highlighting
- Lists (bullet and enumerated)
- Tables
- Links
- Images
- Block quotes
- Definition lists
Installation
pip install rst2gfm
Or install from source:
git clone https://github.com/pdh/rst2gfm.git
cd rst2gfm
pip install -e .
Usage
Command Line
Convert an RST file to Markdown:
rst2gfm input.rst -o output.md
Use stdin/stdout:
cat input.rst | rst2gfm > output.md
Python API
from rst2gfm import convert_rst_to_md
# Convert RST string to Markdown
rst_content = "**Bold text** in reStructuredText"
md_content = convert_rst_to_md(rst_content)
print(md_content)
# Convert RST file to Markdown file
with open('input.rst', 'r') as f:
rst_content = f.read()
md_content = convert_rst_to_md(rst_content)
with open('output.md', 'w') as f:
f.write(md_content)
Limitations
This converter handles most common RST elements, but some advanced features may not be fully supported:
- Complex nested structures
- Custom RST directives
- Some Sphinx-specific extensions
Development
Running Tests
pip install pytest
pytest
Metadata
Release files for rst2gfm 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rst2gfm-0.1.2.tar.gz | 12.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rst2gfm-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.8 kB
Release files / rst2gfm-0.1.2.tar.gz
| Download URL | rst2gfm-0.1.2.tar.gz |
|---|---|
| Size | 12.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ea7525345ccdeba1262f695c6ccf11506ffafe94a101271d4ffab91de9c20bfd
|
|
BLAKE2b-256 checksum How to use checksums |
b333d9797e283183fcd0a8186cbf09b5e809205900487c855201d0d9aa3212e6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 1, 2025.
Transparency logRelease files / rst2gfm-0.1.2-py3-none-any.whl
| Download URL | rst2gfm-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a7ea1c7945aa029c8ef119f86f1e4d96de01894664609d06605162624327099c
|
|
BLAKE2b-256 checksum How to use checksums |
591d07ddcd5453fe8fe9e4b3d3b3b40493455e4e6681f9dadd33a538ac30fbb2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 1, 2025.
Transparency log