Package: rst2gemtext
rst2gemtext aims to convertreStructuredTextmarkup toGemtext, the markup format used by Gemini. It can be used both as aPython libraryor as aCLI tool.This project is currently work in progress.RequirementsPython >= 3.7docutilspygmentsInstallationpip install rst2gemtextUsageCommand Line Interface (CLI)Example:rst2gemtext input.rst output.gmiUsage:usage: rst2gemtext [-h] [--print-xml] input_rst output_gemtext

Converts reStructuredText to Gemtext (Gemini markup format)

positional arguments:
  input_rst       the reStructuredText file to convert
  output_gemtext  the output Gemtext file

options:
  -h, --help      show this help message and exit
  --print-xml     print the reStructuredText DOM as XML for debugging purpose

Inaccurate output? Report bugs to https://github.com/flozz/rst2gemtext/issuesPython LibraryExample: Converting a reStructuredText string to a Gemtext string:importrst2gemtextoutput_gemtext=rst2gemtext.convert("my restructured text string")Example: Converting a reStructuredText file to a Gemtext file:importrst2gemtextwithopen("input.rst","r")asinput_file:input_rst=input_file.read()output_gemtext=rst2gemtext.convert(input_rst)withopen("output.gmi","w")asoutput_file:output_file.write(output_gemtext)ContributingQuestionsIf you have any question, you can:Open an issueon GitHubAsk on Discord(I am not always available to chat, but I try to answer to everyone)BugsPleaseopen an issueon GitHub with as much information as possible if you found a bug:Your operating system / Linux distribution (and its version)How you installed the softwareAll the logs and message outputted by the softwareetc.If the issue is about the outputted Gemtext (wrong markup, unsupported reStructuredText feature,…), please provide:An example reStructuedText document that generates the wrong output or that contains the unsupported syntaxThe wrong Gemtext output (the one currently generated by rst2gemtext)The expected Gemtext outputPull requestsPlease considerfiling a bugbefore starting to work on a new feature; it will allow us to discuss the best way to do it. It is obviously unnecessary if you just want to fix a typo or small errors in the code.Please note that your code must follow the coding style defined by thepep8and pass tests.BlackandFlake8are used on this project to enforce the coding style.Run the testsYou must installNoxfirst:pip3 install noxThen you can check for lint error:nox --session lintand run the tests:nox --session testYou can use following commands to run the tests only on a certain Python version (the corresponding Python interpreter must be installed on your machine):nox --session test-3.7
nox --session test-3.8
nox --session test-3.9
nox --session test-3.10
nox --session test-3.11You can also fix coding style errors automatically with:nox -s black_fixSupport this projectWant to support this project?☕️ Buy me a coffee💵️ Give me a tip on PayPal❤️ Sponsor me on GitHubChangelog[NEXT](changes onmaster, but not released yet):Nothing yet ;)v0.3.1:Fixed truncated tables when last row contains bullet lists (@flozz, #1)v0.3.0:Handle admonitons (admonition,attention,caution,danger,error,hint,important,note,tipandwarningnodes) (@flozz)v0.2.0:Pass the source file name to docutils to allow theincludedirective to
work (@flozz)Added a basic support of thetable(and associatad) nodes (@flozz)v0.1.0:Initial release.Supported rst nodes:block_quotebullet_listcaptioncommentemphasisenumerated_listfigureimagelist_itemliteralliteral_blockparagraphrawreferencesectionstrongsubstitution_definitionsubstitution_referencesystem_messagetargetTexttitletransition