Skip to content
Merged
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
2 changes: 2 additions & 0 deletions docs/_quartodoc-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -357,3 +358,4 @@ quartodoc:
contents:
- name: experimental.ui.card_image
dynamic: false

1 change: 1 addition & 0 deletions docs/_quartodoc-express.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
40 changes: 8 additions & 32 deletions docs/_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
from griffe import (
Alias,
DocstringAttribute,
DocstringParameter,
DocstringSectionParameters,
DocstringSectionText,
Expr,
ExprName,
Expand All @@ -22,8 +20,8 @@
)
from plum import dispatch
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

Expand Down Expand Up @@ -101,12 +99,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
Expand Down Expand Up @@ -170,28 +168,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'<span class="parameter-name">{el.name}</span>'
annotation = self.render_annotation(el.annotation)
if annotation:
param = f'{param}<span class="parameter-annotation-sep">:</span> <span class="parameter-annotation">{annotation}</span>'
if el.default:
param = f'{param} <span class="parameter-default-sep">=</span> <span class="parameter-default">{el.default}</span>'

# Wrap everything in a code block to allow for links
param = "<code>" + param + "</code>"

return (param, el.description)

@dispatch
def render(self, el: DocstringSectionParameters):
rows = list(map(self.render, el.value))
# rows is a list of tuples of (<parameter>, <description>)

return str(DefinitionList(rows))

@dispatch
def signature(self, el: Function, source: Optional[Alias] = None):
if el.name == "__call__":
Expand Down Expand Up @@ -279,7 +255,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

Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,9 @@ doc = [
"tabulate",
"shinylive",
"pydantic>=2.7.4",
"quartodoc>=0.7.6",
"griffe>=1.1.1",
# "quartodoc>=0.8.0",
"quartodoc@git+https://github.com/machow/quartodoc@main",
"griffe>=1.3.2",
]

[project.urls]
Expand Down
4 changes: 2 additions & 2 deletions shiny/render/_data_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -850,9 +850,9 @@ async def update_cell_value(
----------
value
The new value to set the cell to.
row_index
row
The row index of the cell to update.
column_index
column
The column index of the cell to update.
"""
# TODO-barret; Test these assertions
Expand Down
Loading