Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion quartodoc/autosummary.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,8 @@ class Builder:
parser:
Docstring parser to use. This correspond to different docstring styles,
and can be one of "google", "sphinx", and "numpy". Defaults to "numpy".

kwargs:
Additional options are ignored with a warning for forwards compatibility.
"""

# builder dispatching ----
Expand Down Expand Up @@ -495,6 +496,7 @@ def __init__(
parser="numpy",
render_interlinks: bool = False,
_fast_inventory=False,
**kwargs: Any
):
self.layout = self.load_layout(
sections=sections, package=package, options=options
Expand All @@ -508,6 +510,15 @@ def __init__(
self.css = css
self.parser = parser

if len(kwargs) > 0:
ignored_keys = [f"'{k}'" for k in kwargs.keys()]
text_options = "option" if len(kwargs) == 1 else "options"
raise ValueError(
f"Unknown quartodoc {text_options}: {', '.join(ignored_keys)}. "
"Please see <https://machow.github.io/quartodoc/get-started/basic-docs.html> "
"for quartodoc site configuration options."
)

self.renderer = Renderer.from_config(renderer)
if render_interlinks:
# this is a top-level option, but lives on the renderer
Expand Down
16 changes: 16 additions & 0 deletions quartodoc/tests/test_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ def test_builder_auto_options():
builder = Builder.from_quarto_config(cfg)
assert builder.layout.options.members == ["a_func", "a_attr"]

def test_builder_error_unknown_options():
cfg = yaml.safe_load(
"""
quartodoc:
package: quartodoc
this_is_not_a_real_option: true
options:
members: [a_func, a_attr]
sections:
- contents: [quartodoc.tests.example]
"""
)

with pytest.raises(ValueError):
Builder.from_quarto_config(cfg)


def test_builder_generate_sidebar(tmp_path, snapshot):
cfg = yaml.safe_load(
Expand Down