Adding doctest for md_prefix function in build_directory_md.py (#12874)

* Adding doctests for md_prefix function in build_directory_md.py

* Update build_directory_md.py

* Update build_directory_md.py

* Update build_directory_md.py

---------

Co-authored-by: Maxim Smolskiy <mithridatus@mail.ru>
This commit is contained in:
Diya
2025-08-24 16:52:00 +05:30
committed by GitHub
parent c2b90034a0
commit 9ddb0272bf

View File

@@ -18,8 +18,20 @@ def good_file_paths(top_dir: str = ".") -> Iterator[str]:
yield os.path.join(dir_path, filename).lstrip("./")
def md_prefix(i):
return f"{i * ' '}*" if i else "\n##"
def md_prefix(indent: int) -> str:
"""
Markdown prefix based on indent for bullet points
>>> md_prefix(0)
'\\n##'
>>> md_prefix(1)
' *'
>>> md_prefix(2)
' *'
>>> md_prefix(3)
' *'
"""
return f"{indent * ' '}*" if indent else "\n##"
def print_path(old_path: str, new_path: str) -> str: