Skip to content

Commit a9c289c

Browse files
committed
feat: allow specifying docstring parser
1 parent d4b9456 commit a9c289c

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

quartodoc/autosummary.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,6 +427,7 @@ def __init__(
427427
rewrite_all_pages=False,
428428
source_dir: "str | None" = None,
429429
dynamic: bool | None = None,
430+
parser="numpy",
430431
):
431432
self.layout = self.load_layout(sections=sections, package=package)
432433

@@ -435,6 +436,7 @@ def __init__(
435436
self.dir = dir
436437
self.title = title
437438
self.sidebar = sidebar
439+
self.parser = parser
438440

439441
self.renderer = Renderer.from_config(renderer)
440442

@@ -483,7 +485,7 @@ def build(self, filter: str = "*"):
483485
# shaping and collection ----
484486

485487
_log.info("Generating blueprint.")
486-
blueprint = blueprint(self.layout, dynamic=self.dynamic)
488+
blueprint = blueprint(self.layout, dynamic=self.dynamic, parser=self.parser)
487489

488490
_log.info("Collecting pages and inventory items.")
489491
pages, items = collect(blueprint, base_dir=self.dir)

quartodoc/builder/blueprint.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,10 @@ def _auto_package(mod: dc.Module) -> list[Section]:
4141
# get module members for content ----
4242
contents = []
4343
for name, member in mod.members.items():
44-
if member.is_module or name.startswith("__all__"):
44+
external_alias = member.is_alias and not member.target_path.startswith(
45+
mod.name.split(".")[0]
46+
)
47+
if external_alias or member.is_module or name.startswith("__"):
4548
continue
4649

4750
contents.append(Auto(name=name))
@@ -268,7 +271,9 @@ def blueprint(el: Auto, package: str) -> Doc:
268271
...
269272

270273

271-
def blueprint(el: _Base, package: str = None, dynamic: None | bool = None) -> _Base:
274+
def blueprint(
275+
el: _Base, package: str = None, dynamic: None | bool = None, parser="numpy"
276+
) -> _Base:
272277
"""Convert a configuration element to something that is ready to render.
273278
274279
Parameters
@@ -293,7 +298,7 @@ def blueprint(el: _Base, package: str = None, dynamic: None | bool = None) -> _B
293298
294299
"""
295300

296-
trans = BlueprintTransformer()
301+
trans = BlueprintTransformer(parser=parser)
297302

298303
if package is not None:
299304
trans.crnt_package = package

0 commit comments

Comments
 (0)