diff --git a/src/lazydocs/_about.py b/src/lazydocs/_about.py
index a7b66d7..b71acbc 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.5.2"
# __author__
# __email__
diff --git a/src/lazydocs/generation.py b/src/lazydocs/generation.py
index 8196665..bbbc562 100755
--- a/src/lazydocs/generation.py
+++ b/src/lazydocs/generation.py
@@ -220,7 +220,7 @@ def to_md_file(
return
md_file = filename
-
+
if is_mdx:
if not filename.endswith(".mdx"):
md_file = filename + ".mdx"
@@ -429,13 +429,16 @@ def _doc2md(obj: Any) -> str:
argindent = indent
elif arg_list and not literal_block and _RE_ARGSTART.match(line):
# start of an exception-type block
- out.append(
- "\n"
- + " " * blockindent
- + " - "
- + _RE_ARGSTART.sub(r"`\1`: \2", line)
- )
- argindent = indent
+ if indent > argindent:
+ out.append(" " + line)
+ else:
+ out.append(
+ "\n"
+ + " " * blockindent
+ + " - "
+ + _RE_ARGSTART.sub(r"`\1`: \2", line)
+ )
+ argindent = indent
elif indent > argindent:
# attach docs text of argument
# * (blockindent + 2)
@@ -614,7 +617,7 @@ def func2md(self, func: Callable, clsname: str = "", depth: int = 3, is_mdx: boo
if path:
if is_mdx:
markdown = _MDX_SOURCE_BADGE_TEMPLATE.format(path=path) + markdown
- else:
+ else:
markdown = _SOURCE_BADGE_TEMPLATE.format(path=path) + markdown
return markdown
@@ -998,8 +1001,13 @@ def generate_docs(
continue
try:
- mod_spec = loader.find_spec(module_name)
- mod = importlib.util.module_from_spec(mod_spec)
+ try:
+ mod_spec = loader.find_spec(module_name)
+ mod = importlib.util.module_from_spec(mod_spec)
+ mod_spec.loader.exec_module(mod)
+ except AttributeError:
+ # For older python version compatibility
+ mod = loader.find_module(module_name).load_module(module_name) # type: ignore
module_md = generator.module2md(mod, is_mdx=is_mdx)
if not module_md:
# Module md is empty -> ignore module and all submodules
@@ -1077,8 +1085,13 @@ def generate_docs(
continue
try:
- mod_spec = loader.find_spec(module_name)
- mod = importlib.util.module_from_spec(mod_spec)
+ try:
+ mod_spec = loader.find_spec(module_name)
+ mod = importlib.util.module_from_spec(mod_spec)
+ mod_spec.loader.exec_module(mod)
+ except AttributeError:
+ # For older python version compatibility
+ mod = loader.find_module(module_name).load_module(module_name) # type: ignore
module_md = generator.module2md(mod, is_mdx=is_mdx)
if not module_md: