Skip to content

Commit 0c9eb45

Browse files
committed
Updated missing documentation for mdx support
1 parent 0a79225 commit 0c9eb45

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

Diff for: README.md

+1
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ lazydocs [OPTIONS] PATHS...
176176
* `--ignored-modules TEXT`: A list of modules that should be ignored. [default: ]
177177
* `--watermark / --no-watermark`: If `True`, add a watermark with a timestamp to bottom of the markdown files. [default: True]
178178
* `--validate / --no-validate`: If `True`, validate the docstrings via pydocstyle. Requires pydocstyle to be installed. [default: False]
179+
* `--output-format TEXT`: The output format for the creation of the markdown files. This may be 'md' or 'mdx'. Defaults to md.
179180
* `--install-completion`: Install completion for the current shell.
180181
* `--show-completion`: Show completion for the current shell, to copy it or customize the installation.
181182
* `--help`: Show this message and exit.

Diff for: src/lazydocs/generation.py

+17-4
Original file line numberDiff line numberDiff line change
@@ -211,16 +211,17 @@ def to_md_file(
211211
Args:
212212
markdown_str (str): Markdown string with line breaks to write to file.
213213
filename (str): Filename without the .md
214+
out_path (str): The output directory.
214215
watermark (bool): If `True`, add a watermark with a timestamp to bottom of the markdown files.
215216
disable_markdownlint (bool): If `True`, an inline tag is added to disable markdownlint for this file.
216-
out_path (str): The output directory
217+
is_mdx (bool, optional): JSX support. Default to False.
217218
"""
218219
if not markdown_str:
219220
# Dont write empty files
220221
return
221222

222223
md_file = filename
223-
224+
224225
if is_mdx:
225226
if not filename.endswith(".mdx"):
226227
md_file = filename + ".mdx"
@@ -538,6 +539,7 @@ def func2md(self, func: Callable, clsname: str = "", depth: int = 3, is_mdx: boo
538539
func (Callable): Selected function (or method) for markdown generation.
539540
clsname (str, optional): Class name to prepend to funcname. Defaults to "".
540541
depth (int, optional): Number of # to append to class name. Defaults to 3.
542+
is_mdx (bool, optional): JSX support. Default to False.
541543
542544
Returns:
543545
str: Markdown documentation for selected function.
@@ -614,7 +616,7 @@ def func2md(self, func: Callable, clsname: str = "", depth: int = 3, is_mdx: boo
614616
if path:
615617
if is_mdx:
616618
markdown = _MDX_SOURCE_BADGE_TEMPLATE.format(path=path) + markdown
617-
else:
619+
else:
618620
markdown = _SOURCE_BADGE_TEMPLATE.format(path=path) + markdown
619621

620622
return markdown
@@ -625,6 +627,7 @@ def class2md(self, cls: Any, depth: int = 2, is_mdx: bool = False) -> str:
625627
Args:
626628
cls (class): Selected class for markdown generation.
627629
depth (int, optional): Number of # to append to function name. Defaults to 2.
630+
is_mdx (bool, optional): JSX support. Default to False.
628631
629632
Returns:
630633
str: Markdown documentation for selected class.
@@ -739,6 +742,7 @@ def module2md(self, module: types.ModuleType, depth: int = 1, is_mdx: bool = Fal
739742
Args:
740743
module (types.ModuleType): Selected module for markdown generation.
741744
depth (int, optional): Number of # to append before module heading. Defaults to 1.
745+
is_mdx (bool, optional): JSX support. Default to False.
742746
743747
Returns:
744748
str: Markdown documentation for selected module.
@@ -837,6 +841,7 @@ def import2md(self, obj: Any, depth: int = 1, is_mdx: bool = False) -> str:
837841
Args:
838842
obj (Any): Selcted object for markdown docs generation.
839843
depth (int, optional): Number of # to append before heading. Defaults to 1.
844+
is_mdx (bool, optional): JSX support. Default to False.
840845
841846
Returns:
842847
str: Markdown documentation of selected object.
@@ -852,7 +857,14 @@ def import2md(self, obj: Any, depth: int = 1, is_mdx: bool = False) -> str:
852857
return ""
853858

854859
def overview2md(self, is_mdx: bool = False) -> str:
855-
"""Generates a documentation overview file based on the generated docs."""
860+
"""Generates a documentation overview file based on the generated docs.
861+
862+
Args:
863+
is_mdx (bool, optional): JSX support. Default to False.
864+
865+
Returns:
866+
str: Markdown documentation of overview file.
867+
"""
856868

857869
entries_md = ""
858870
for obj in list(
@@ -935,6 +947,7 @@ def generate_docs(
935947
src_base_url: The base url of the github link. Should include branch name. All source links are generated with this prefix.
936948
remove_package_prefix: If `True`, the package prefix will be removed from all functions and methods.
937949
ignored_modules: A list of modules that should be ignored.
950+
output_format: Markdown file extension and format.
938951
overview_file: Filename of overview file. If not provided, no overview file will be generated.
939952
watermark: If `True`, add a watermark with a timestamp to bottom of the markdown files.
940953
validate: If `True`, validate the docstrings via pydocstyle. Requires pydocstyle to be installed.

0 commit comments

Comments
 (0)