Skip to content

Commit 01c0e25

Browse files
committed
Add option to disable markdownlint for the file
1 parent 901d38b commit 01c0e25

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/lazydocs/generation.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,20 +179,28 @@ def _order_by_line_nos(objs: Any, line_nos: List[int]) -> List[str]:
179179

180180

181181
def to_md_file(
182-
string: str, filename: str, out_path: str = ".", watermark: bool = True
182+
string: str,
183+
filename: str,
184+
out_path: str = ".",
185+
watermark: bool = True,
186+
disable_markdownlint: bool = True,
183187
) -> None:
184188
"""Creates an API docs file from a provided text.
185189
186190
Args:
187191
string (str): String with line breaks to write to file.
188192
filename (str): Filename without the .md
189193
watermark (bool): If `True`, add a watermark with a timestamp to bottom of the markdown files.
194+
disable_markdownlint (bool): If `True`, an inline tag is added to disable markdownlint for this file.
190195
out_path (str): The output directory
191196
"""
192197
md_file = filename
193198
if not filename.endswith(".md"):
194199
md_file = filename + ".md"
195200

201+
if disable_markdownlint:
202+
string = "<!-- markdownlint-disable -->\n" + string
203+
196204
if watermark:
197205
string += _WATERMARK_TEMPLATE.format(
198206
date=datetime.date.today().strftime("%d %b %Y")
@@ -919,7 +927,7 @@ def generate_docs(
919927

920928
if hasattr(obj, "__path__"):
921929
# Object is a package
922-
for loader, module_name, is_pkg in pkgutil.walk_packages(
930+
for loader, module_name, _ in pkgutil.walk_packages(
923931
path=obj.__path__, # type: ignore
924932
prefix=obj.__name__ + ".", # type: ignore
925933
):

0 commit comments

Comments
 (0)