diff --git a/.github/workflows/build-docs.yaml b/.github/workflows/build-docs.yaml index f88b71ef9..76f431934 100644 --- a/.github/workflows/build-docs.yaml +++ b/.github/workflows/build-docs.yaml @@ -39,6 +39,7 @@ jobs: - name: Install dependencies run: | make ci-install-docs + pip install git+https://github.com/machow/quartodoc.git@main - name: Run quartodoc run: | diff --git a/docs/_quartodoc-core.yml b/docs/_quartodoc-core.yml index d3dbea99e..d31b7f989 100644 --- a/docs/_quartodoc-core.yml +++ b/docs/_quartodoc-core.yml @@ -9,6 +9,7 @@ quartodoc: renderer: style: _renderer.py show_signature_annotations: false + table_style: description-list sections: - title: Page containers desc: Create a user interface page container. @@ -357,3 +358,4 @@ quartodoc: contents: - name: experimental.ui.card_image dynamic: false + diff --git a/docs/_quartodoc-express.yml b/docs/_quartodoc-express.yml index dbee0b740..2b1f8e50c 100644 --- a/docs/_quartodoc-express.yml +++ b/docs/_quartodoc-express.yml @@ -9,6 +9,7 @@ quartodoc: renderer: style: _renderer.py show_signature_annotations: false + table_style: description-list sections: - title: Input components desc: Gather user input. diff --git a/docs/_renderer.py b/docs/_renderer.py index 4d7299398..c07f91e49 100644 --- a/docs/_renderer.py +++ b/docs/_renderer.py @@ -24,6 +24,7 @@ from quartodoc import MdRenderer from quartodoc.pandoc.blocks import DefinitionList from quartodoc.renderers.base import convert_rst_link_to_md, sanitize +from quartodoc.renderers.md_renderer import ParamRow # from quartodoc.ast import preview @@ -101,12 +102,12 @@ def render_annotation(self, el: str): # TODO-future; Can be removed once we use quartodoc 0.3.5 # Related: https://github.com/machow/quartodoc/pull/205 @dispatch - def render(self, el: DocstringAttribute): - row = [ - sanitize(el.name), - self.render_annotation(el.annotation), - sanitize(el.description or "", allow_markdown=True), - ] + def render(self, el: DocstringAttribute) -> ParamRow: + row = ParamRow( + el.name, + el.description or "", + annotation=self.render_annotation(el.annotation), + ) return row @dispatch @@ -170,28 +171,6 @@ def summarize(self, obj: Union[Object, Alias]) -> str: return "" - # Consolidate the parameter type info into a single column - @dispatch - def render(self, el: DocstringParameter): - param = f'{el.name}' - annotation = self.render_annotation(el.annotation) - if annotation: - param = f'{param}: {annotation}' - if el.default: - param = f'{param} = {el.default}' - - # Wrap everything in a code block to allow for links - param = "" + param + "" - - return (param, el.description) - - @dispatch - def render(self, el: DocstringSectionParameters): - rows = list(map(self.render, el.value)) - # rows is a list of tuples of (, ) - - return str(DefinitionList(rows)) - @dispatch def signature(self, el: Function, source: Optional[Alias] = None): if el.name == "__call__": @@ -279,7 +258,7 @@ def read_file(file: str | Path, root_dir: str | Path | None = None) -> FileConte def check_if_missing_expected_example(el, converted): - if re.search(r"(^|\n)#{2,6} Examples\n", converted): + if re.search(r"(^|\n)#{2,6} Examples", converted): # Manually added examples are fine return