Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
1 change: 1 addition & 0 deletions .github/workflows/build-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
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
37 changes: 8 additions & 29 deletions docs/_renderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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'<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 +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):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quartodoc adds class names to the sections now, so we had to remove the newline from the regex.

# Manually added examples are fine
return

Expand Down
12 changes: 0 additions & 12 deletions shiny/input_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,6 @@ def _process_value(
for more information on how to create custom input bindings. (The article is about
Shiny for R, but the JavaScript and general principles are the same.)

Methods
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I deleted this while pairing w/ Barret, but can put back in. I think it caused griffe to error when parsing the docstring (but could be wrong).

--------
add(type: str, force: bool = False) -> Callable[[InputHandlerType], None]
Register an input handler. This method returns a decorator that registers the
decorated function as the handler for the given ``type``. This handler should
accept three arguments:
- the input ``value``
- the input ``name``
- the :class:`~shiny.Session` object
remove(type: str)
Unregister an input handler.

Note
----
``add()`` ing an input handler will make it persist for the duration of the Python
Expand Down
Loading