Skip to main content
Author:

Hartmut Goebel <h.goebel@crazy-compilers.com>

Licence:

GNU General Public Licence v3 or later (GPLv3+)

This tool allows you writing documentation directly into YAML-files as comments. These comments will then be converted to text and the YAML-code goes into literal blocks.

This is some kind of literate programming, except that you do not write code into your text, but text into your code. This difference allows to process the YAML file directly without any pre-processing.

Usage:

yaml2rst [-h] [--strip-regex regex] infile outfile

positional arguments:
  infile               YAML-file to read (`-` for stdin)
  outfile              rst-file to write (`-` for stdout)

optional arguments:
  -h, --help           show this help message and exit
  --strip-regex regex  Regex which will remove everything it matches. Can be
                       used to remove fold markers from headings for example.
                       Example to strip out [[[,]]] fold markers:
                       '\s*(:?\[{3}|\]{3})\d?$'. Check the README for more
                       details.

How it works

This script takes all lines beginning with # (and lines consisting of only a #) as text-lines. Everything else will be treated as “code”. The text-lines will get the # removed and the “code” will get spaces prepended.

Additionally at the start and at the end of a “code”-block, lines are added as required by reStructuredText. Also at the begin of a “code”-block, a :: is added if required.

--strip-regex can be used to remove matching characters from text-lines when needed. Refer to documentation about Folding marks support for details.

Examples

You can find example yaml-input, rst-output and generated html in the examples directory. You may also view the generated html online at https://rawgit.com/debops/yaml2rst/develop/examples/main.html.

Maintainers

yaml2rst was originally developed 2015 and maintained by Hartmut Goebel. In 2019 the project moved to the debops project for which yaml2rst was developed.

Metadata

Release files for yaml2rst 0.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for yaml2rst 0.3
File Size Uploaded
yaml2rst-0.3.tar.gz 26.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for yaml2rst 0.3
File Interpreter ABI Platform
yaml2rst-0.3-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 34.7 kB

Release files / yaml2rst-0.3.tar.gz

Download URL yaml2rst-0.3.tar.gz
Size 26.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b517836b5d84d76b5b479ea8ba59bddef3f7bbe3bbb8ba770334b2dd2856b28b
BLAKE2b-256 checksum
How to use checksums
de881685f29d0627ec24bb0ccf790a4f1d0d276a4949db4288835163bd9b8c66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

Release files / yaml2rst-0.3-py2.py3-none-any.whl

Download URL yaml2rst-0.3-py2.py3-none-any.whl
Size 8.4 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
e563869fb1797ab3c560bca2d916b50b5df49003a22e2f77b5ec2b1c37430d54
BLAKE2b-256 checksum
How to use checksums
93af1720183746de57e8a9dba661e65afc8afe0fc490fc7a8cd044f7cd3cf3c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.9.1 pkginfo/1.4.1 requests/2.18.4 setuptools/38.2.4 requests-toolbelt/0.8.0 tqdm/4.19.5 CPython/2.7.15

Release history Release notifications | RSS feed

This release

0.3 This release

2 release files

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page