From a98bf47004a76578e6893b4ba6d9447322137a3c Mon Sep 17 00:00:00 2001 From: Michael Chow Date: Mon, 30 Sep 2024 16:28:53 -0400 Subject: [PATCH] fix: use shortname for member children linked style --- quartodoc/renderers/md_renderer.py | 2 +- .../tests/__snapshots__/test_renderers.ambr | 27 +++++++++++++++++++ quartodoc/tests/test_renderers.py | 2 +- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/quartodoc/renderers/md_renderer.py b/quartodoc/renderers/md_renderer.py index 583071e..df0a6c6 100644 --- a/quartodoc/renderers/md_renderer.py +++ b/quartodoc/renderers/md_renderer.py @@ -768,7 +768,7 @@ def summarize( @dispatch def summarize(self, el: layout.Link): description = self.summarize(el.obj) - return self._summary_row(f"[](`{el.name}`)", description) + return self._summary_row(f"[](`~{el.name}`)", description) @dispatch def summarize(self, obj: Union[dc.Object, dc.Alias]) -> str: diff --git a/quartodoc/tests/__snapshots__/test_renderers.ambr b/quartodoc/tests/__snapshots__/test_renderers.ambr index a46143e..641f27c 100644 --- a/quartodoc/tests/__snapshots__/test_renderers.ambr +++ b/quartodoc/tests/__snapshots__/test_renderers.ambr @@ -314,6 +314,33 @@ A function ''' # --- +# name: test_render_doc_module[linked] + ''' + # quartodoc.tests.example { #quartodoc.tests.example } + + `tests.example` + + A module + + ## Attributes + + | Name | Description | + | --- | --- | + | [](`~quartodoc.tests.example.a_attr`) | An attribute | + + ## Classes + + | Name | Description | + | --- | --- | + | [](`~quartodoc.tests.example.AClass`) | A class | + + ## Functions + + | Name | Description | + | --- | --- | + | [](`~quartodoc.tests.example.a_func`) | A function | + ''' +# --- # name: test_render_doc_signature_name ''' # example.a_func { #quartodoc.tests.example.a_func } diff --git a/quartodoc/tests/test_renderers.py b/quartodoc/tests/test_renderers.py index d02b0e2..8d92238 100644 --- a/quartodoc/tests/test_renderers.py +++ b/quartodoc/tests/test_renderers.py @@ -126,7 +126,7 @@ def test_render_doc_section_admonition(renderer): assert res == "quartodoc.tests.example: Method for doing a thing" -@pytest.mark.parametrize("children", ["embedded", "flat"]) +@pytest.mark.parametrize("children", ["embedded", "flat", "linked"]) def test_render_doc_module(snapshot, renderer, children): bp = blueprint(Auto(name="quartodoc.tests.example", children=children)) res = renderer.render(bp)