Skip to content

Latest commit

 

History

History
225 lines (126 loc) · 6.95 KB

lazydocs.generation.md

File metadata and controls

225 lines (126 loc) · 6.95 KB

module lazydocs.generation

Main module for markdown generation.


function to_md_file

to_md_file(
    markdown_str: str,
    filename: str,
    out_path: str = '.',
    watermark: bool = True,
    disable_markdownlint: bool = True
) → None

Creates an API docs file from a provided text.

Args:

  • markdown_str (str): Markdown string with line breaks to write to file.
  • filename (str): Filename without the .md
  • watermark (bool): If True, add a watermark with a timestamp to bottom of the markdown files.
  • disable_markdownlint (bool): If True, an inline tag is added to disable markdownlint for this file.
  • out_path (str): The output directory

function generate_docs

generate_docs(
    paths: List[str],
    output_path: str = './docs',
    src_root_path: Optional[str] = None,
    src_base_url: Optional[str] = None,
    remove_package_prefix: bool = False,
    ignored_modules: Optional[List[str]] = None,
    overview_file: Optional[str] = None,
    watermark: bool = True,
    validate: bool = False
) → None

Generates markdown documentation for provided paths based on Google-style docstrings.

Args:

  • paths: Selected paths or import name for markdown generation.
  • output_path: The output path for the creation of the markdown files. Set this to stdout to print all markdown to stdout.
  • src_root_path: The root folder name containing all the sources. Fallback to git repo root.
  • src_base_url: The base url of the github link. Should include branch name. All source links are generated with this prefix.
  • remove_package_prefix: If True, the package prefix will be removed from all functions and methods.
  • ignored_modules: A list of modules that should be ignored.
  • overview_file: Filename of overview file. If not provided, no overview file will be generated.
  • watermark: If True, add a watermark with a timestamp to bottom of the markdown files.
  • validate: If True, validate the docstrings via pydocstyle. Requires pydocstyle to be installed.

class MarkdownGenerator

Markdown generator class.

method __init__

__init__(
    src_root_path: Optional[str] = None,
    src_base_url: Optional[str] = None,
    remove_package_prefix: bool = False
)

Initializes the markdown API generator.

Args:

  • src_root_path: The root folder name containing all the sources.
  • src_base_url: The base github link. Should include branch name. All source links are generated with this prefix.
  • remove_package_prefix: If True, the package prefix will be removed from all functions and methods.

method class2md

class2md(cls: Any, depth: int = 2) → str

Takes a class and creates markdown text to document its methods and variables.

Args:

  • cls (class): Selected class for markdown generation.
  • depth (int, optional): Number of # to append to function name. Defaults to 2.

Returns:

  • str: Markdown documentation for selected class.

method func2md

func2md(func: Callable, clsname: str = '', depth: int = 3) → str

Takes a function (or method) and generates markdown docs.

Args:

  • func (Callable): Selected function (or method) for markdown generation.
  • clsname (str, optional): Class name to prepend to funcname. Defaults to "".
  • depth (int, optional): Number of # to append to class name. Defaults to 3.

Returns:

  • str: Markdown documentation for selected function.

method import2md

import2md(obj: Any, depth: int = 1) → str

Generates markdown documentation for a selected object/import.

Args:

  • obj (Any): Selcted object for markdown docs generation.
  • depth (int, optional): Number of # to append before heading. Defaults to 1.

Returns:

  • str: Markdown documentation of selected object.

method module2md

module2md(module: module, depth: int = 1) → str

Takes an imported module object and create a Markdown string containing functions and classes.

Args:

  • module (types.ModuleType): Selected module for markdown generation.
  • depth (int, optional): Number of # to append before module heading. Defaults to 1.

Returns:

  • str: Markdown documentation for selected module.

method overview2md

overview2md() → str

Generates a documentation overview file based on the generated docs.


This file was automatically generated via lazydocs.