A formatter for reStructuredText
Project description
Not to be confused with rustfmt.
Highly experimental and unstable. Do not depend on this yet.
Description
rstfmt is a tool for automatically formatting reStructuredText files in a consistent way.
Like Black and gofmt, the motivation is to provide a format that is reasonable and minimally configurable to prevent teams from wasting time on style discussions (or individuals on manually doing formatting, for that matter).
Currently, rstfmt is in an extremely early stage of development. Not all reST constructs are covered and the interface or formatting may change at any time without warning.
Usage
# Install.
pip install https://github.com/dzhu/rstfmt
# Read a file from stdin and write the formatted version to stdout.
rstfmt
# Format the given files, printing all output to stdout.
rstfmt <file>...
# Format the given files in place.
rstfmt -i <file>...
# Wrap paragraphs to the given line length (default 72).
rstfmt -w <width>
Like Black’s blackd, there is also a daemon that provides formatting via HTTP requests to avoid the cost of starting and importing everything on every run.
# Install.
pip install https://github.com/dzhu/rstfmt[d]
# Start the daemon (binds to localhost:5219 by default).
rstfmtd --bind-host=<host> --bind-port=<port>
# Print the formatted version of a file.
curl http://locahost:5219 --data-binary @<file>
# Specify the line length (default 72).
curl -H 'X-Line-Length: 72' http://locahost:5219 --data-binary @<file>
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.