diff --git a/docs/lazydocs.generation.md b/docs/lazydocs.generation.md index 1b21093..1f2d163 100644 --- a/docs/lazydocs.generation.md +++ b/docs/lazydocs.generation.md @@ -1,14 +1,28 @@ - + # module `lazydocs.generation` -Main module for markdown generation. +Main module for markdown generation. + + +## Table of Contents +- [`MarkdownGenerator`](./lazydocs.generation.md#class-markdowngenerator) + - [`__init__`](./lazydocs.generation.md#constructor-__init__) + - [`class2md`](./lazydocs.generation.md#method-class2md) + - [`func2md`](./lazydocs.generation.md#method-func2md) + - [`import2md`](./lazydocs.generation.md#method-import2md) + - [`module2md`](./lazydocs.generation.md#method-module2md) + - [`overview2md`](./lazydocs.generation.md#method-overview2md) + - [`toc2md`](./lazydocs.generation.md#method-toc2md) +- [`generate_docs`](./lazydocs.generation.md#function-generate_docs) +- [`to_md_file`](./lazydocs.generation.md#function-to_md_file) + --- - + ## function `to_md_file` @@ -18,26 +32,28 @@ to_md_file( filename: str, out_path: str = '.', watermark: bool = True, - disable_markdownlint: bool = True + disable_markdownlint: bool = True, + is_mdx: bool = False ) → None ``` -Creates an API docs file from a provided text. - +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 + +- `markdown_str` (str): Markdown string with line breaks to write to file. +- `filename` (str): Filename without the .md +- `out_path` (str): The output directory. +- `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. +- `is_mdx` (bool, optional): JSX support. Default to False. + --- - + ## function `generate_docs` @@ -49,173 +65,225 @@ generate_docs( src_base_url: Optional[str] = None, remove_package_prefix: bool = False, ignored_modules: Optional[List[str]] = None, + output_format: Optional[str] = None, overview_file: Optional[str] = None, watermark: bool = True, - validate: bool = False + validate: bool = False, + private_modules: bool = False, + include_toc: bool = False, + url_line_prefix: Optional[str] = None ) → None ``` -Generates markdown documentation for provided paths based on Google-style docstrings. - +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. + +- `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. +- `output_format`: Markdown file extension and format. +- `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. +- `private_modules`: If `True`, includes modules with `_` prefix. +- `url_line_prefix: Line prefix for git repository line url anchors. Default`: None - github "L". + --- - + ## class `MarkdownGenerator` -Markdown generator class. +Markdown generator class. - -### method `__init__` + + +### constructor `__init__` ```python -__init__( +MarkdownGenerator( src_root_path: Optional[str] = None, src_base_url: Optional[str] = None, - remove_package_prefix: bool = False + remove_package_prefix: bool = False, + url_line_prefix: Optional[str] = None ) ``` -Initializes the markdown API generator. - +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. + +- `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. +- `url_line_prefix: Line prefix for git repository line url anchors. Default`: None - github "L". + --- - + ### method `class2md` ```python -class2md(cls: Any, depth: int = 2) → str +class2md(cls: Any, depth: int = 2, is_mdx: bool = False) → str ``` -Takes a class and creates markdown text to document its methods and variables. - +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. +- `cls` (class): Selected class for markdown generation. +- `depth` (int, optional): Number of # to append to function name. Defaults to 2. +- `is_mdx` (bool, optional): JSX support. Default to False. **Returns:** - - - `str`: Markdown documentation for selected class. + +- `str`: Markdown documentation for selected class. + --- - + ### method `func2md` ```python -func2md(func: Callable, clsname: str = '', depth: int = 3) → str +func2md( + func: Callable, + clsname: str = '', + depth: int = 3, + is_mdx: bool = False +) → str ``` -Takes a function (or method) and generates markdown docs. - +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. +- `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. +- `is_mdx` (bool, optional): JSX support. Default to False. **Returns:** - - - `str`: Markdown documentation for selected function. + +- `str`: Markdown documentation for selected function. + --- - + ### method `import2md` ```python -import2md(obj: Any, depth: int = 1) → str +import2md( + obj: Any, + depth: int = 1, + is_mdx: bool = False, + include_toc: bool = False +) → str ``` -Generates markdown documentation for a selected object/import. - +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. +- `obj` (Any): Selcted object for markdown docs generation. +- `depth` (int, optional): Number of # to append before heading. Defaults to 1. +- `is_mdx` (bool, optional): JSX support. Default to False. +- `include_toc` (bool, Optional): Include table of contents for module file. Defaults to False. **Returns:** - - - `str`: Markdown documentation of selected object. + +- `str`: Markdown documentation of selected object. + --- - + ### method `module2md` ```python -module2md(module: module, depth: int = 1) → str +module2md( + module: module, + depth: int = 1, + is_mdx: bool = False, + include_toc: bool = False +) → str ``` -Takes an imported module object and create a Markdown string containing functions and classes. - +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. +- `module` (types.ModuleType): Selected module for markdown generation. +- `depth` (int, optional): Number of # to append before module heading. Defaults to 1. +- `is_mdx` (bool, optional): JSX support. Default to False. +- `include_toc` (bool, optional): Include table of contents in module file. Defaults to False. **Returns:** - - - `str`: Markdown documentation for selected module. + +- `str`: Markdown documentation for selected module. + --- - + ### method `overview2md` ```python -overview2md() → str +overview2md(is_mdx: bool = False) → str +``` + +Generates a documentation overview file based on the generated docs. + + +**Args:** + +- `is_mdx` (bool, optional): JSX support. Default to False. + + +**Returns:** + +- `str`: Markdown documentation of overview file. + + +--- + + + +### method `toc2md` + +```python +toc2md(module: module = None, is_mdx: bool = False) → str ``` -Generates a documentation overview file based on the generated docs. +Generates table of contents for imported object. + diff --git a/src/lazydocs/_about.py b/src/lazydocs/_about.py index a7b66d7..1092556 100644 --- a/src/lazydocs/_about.py +++ b/src/lazydocs/_about.py @@ -1,5 +1,5 @@ """Information about this library. This file will automatically changed.""" -__version__ = "0.5.1" +__version__ = "0.6.0" # __author__ # __email__