Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rst2gfm-0.1.2.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rst2gfm-0.1.2-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

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

Hashes for rst2gfm-0.1.2.tar.gz
Algorithm Hash digest
SHA256 ea7525345ccdeba1262f695c6ccf11506ffafe94a101271d4ffab91de9c20bfd
MD5 8383a09472318c17e8bc46735d799e86
BLAKE2b-256 b333d9797e283183fcd0a8186cbf09b5e809205900487c855201d0d9aa3212e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for rst2gfm-0.1.2.tar.gz:

Publisher: publish.yml on pdh/rst2gfm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for rst2gfm-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a7ea1c7945aa029c8ef119f86f1e4d96de01894664609d06605162624327099c
MD5 5d14ec1acbacb4ea7a89be20164bec0e
BLAKE2b-256 591d07ddcd5453fe8fe9e4b3d3b3b40493455e4e6681f9dadd33a538ac30fbb2

See more details on using hashes here.

Provenance

The following attestation bundles were made for rst2gfm-0.1.2-py3-none-any.whl:

Publisher: publish.yml on pdh/rst2gfm

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page