Skip to main content

A Simple Tool for Documenting YAML Files

Project description

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] 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

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.

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/htgoebel/yaml2rst/develop/examples/main.html.

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

yaml2rst-0.1.zip (26.1 kB view details)

Uploaded Source

File details

Details for the file yaml2rst-0.1.zip.

File metadata

  • Download URL: yaml2rst-0.1.zip
  • Upload date:
  • Size: 26.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yaml2rst-0.1.zip
Algorithm Hash digest
SHA256 e6280bd81284f9cc241b127142029a8b7001eac0fde65b18dce01fac692d4ffe
MD5 9b8a4e636503e4129dfae0ed84ab10c3
BLAKE2b-256 5dc989ee56f3d12ee1ed73c95ee1b935f408078cc7bba84614b27e81204dbda0

See more details on using hashes here.

Supported by

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