marsh.doc

Tools for producing documentation.

marsh.doc.terminal

format_terminal_value(value, width=None, description=None, indent=2, description_indent=24, description_margin=4)[source]

Create a help message in the same style as argparse.ArgumentParser for a value and its description

Parameters:
  • value (str) – The string value.

  • width (Optional[int]) – The width of the message.

  • description (Optional[str]) – A text description for the value.

  • indent (int) – The indentation of the value in number of blank spaces.

  • description_indent (int) – The indentation of the description in number of blank spaces.

  • description_margin (int) – The minimum number of blank spaces between the description and the value. The description will be started on the next line if the resulting margin would be smaller than this on the line containing the argument.

Return type:

str

Returns:

The help message.

marsh.doc.markdown

format_types(source, heading=3)[source]

Return a markdown-formatted string containing registered schema types that have static documention.

A description below each type is included when available.

Parameters:
Return type:

str

Returns:

The formatted markdown.

marsh.doc.restructuredtext

format_table(headers, rows, title=None, widths=None)[source]

Create a RST list-table.

Any newlines in the headers or rows are replaced with whitespace.

Parameters:
  • headers (Sequence) – The header names.

  • rows (Iterable[Sequence]) – Iterable of rows, each row containing the same number of values as there are headers.

  • title (Optional[str]) – A title for the table.

  • widths (Optional[Sequence]) – The width of columns. If given, must contain the same number of values as there are headers.

Return type:

str

Returns:

The table in RST format.

format_types(source, section='^')[source]

Return a RST-formatted string containing registered schema types that have static documention.

A description below each type is included when available.

Parameters:
Return type:

str

Returns:

The formatted RST.

format_types_table(source, title=None)[source]

Return a RST-formatted table containing registered schema types that have static documention.

A description for each type is included when available.

Parameters:
Return type:

str

Returns:

The formatted RST table.