Giter VIP home page Giter VIP logo

yaml2rst's Introduction

yaml2rst

A Simple Tool and Python-Module for Documenting YAML Files

Author: Hartmut Goebel <[email protected]>
Copyright: 2015-2019 by Hartmut Goebel
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.

Related Tools

  • yaml4rst is a linting/checking/reformatting tool for YAML files documented with inline RST which goes hand in hand with yaml2rst.

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.

yaml2rst's People

Contributors

htgoebel avatar ypid avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.