A tool to convert reStructuredText to GitHub Flavored Markdown
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rst2gfm-0.1.2.tar.gz.
File metadata
- Download URL: rst2gfm-0.1.2.tar.gz
- Upload date:
- Size: 12.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea7525345ccdeba1262f695c6ccf11506ffafe94a101271d4ffab91de9c20bfd
|
|
| MD5 |
8383a09472318c17e8bc46735d799e86
|
|
| BLAKE2b-256 |
b333d9797e283183fcd0a8186cbf09b5e809205900487c855201d0d9aa3212e6
|
Provenance
The following attestation bundles were made for rst2gfm-0.1.2.tar.gz:
Publisher:
publish.yml on pdh/rst2gfm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rst2gfm-0.1.2.tar.gz -
Subject digest:
ea7525345ccdeba1262f695c6ccf11506ffafe94a101271d4ffab91de9c20bfd - Sigstore transparency entry: 175752581
- Sigstore integration time:
-
Permalink:
pdh/rst2gfm@aef7b9bcf4b4c0ab312bd964c1332859cebc12c6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/pdh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aef7b9bcf4b4c0ab312bd964c1332859cebc12c6 -
Trigger Event:
push
-
Statement type:
File details
Details for the file rst2gfm-0.1.2-py3-none-any.whl.
File metadata
- Download URL: rst2gfm-0.1.2-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7ea1c7945aa029c8ef119f86f1e4d96de01894664609d06605162624327099c
|
|
| MD5 |
5d14ec1acbacb4ea7a89be20164bec0e
|
|
| BLAKE2b-256 |
591d07ddcd5453fe8fe9e4b3d3b3b40493455e4e6681f9dadd33a538ac30fbb2
|
Provenance
The following attestation bundles were made for rst2gfm-0.1.2-py3-none-any.whl:
Publisher:
publish.yml on pdh/rst2gfm
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
rst2gfm-0.1.2-py3-none-any.whl -
Subject digest:
a7ea1c7945aa029c8ef119f86f1e4d96de01894664609d06605162624327099c - Sigstore transparency entry: 175752584
- Sigstore integration time:
-
Permalink:
pdh/rst2gfm@aef7b9bcf4b4c0ab312bd964c1332859cebc12c6 -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/pdh
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@aef7b9bcf4b4c0ab312bd964c1332859cebc12c6 -
Trigger Event:
push
-
Statement type: