Skip to content

Commit 9805055

Browse files
authored
Merge pull request #121 from machow/docs-overhaul
docs: site overhaul
2 parents 65b4706 + 2c2f22f commit 9805055

38 files changed

+1322
-761
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ jobs:
8383
python -m pip install shiny shinylive
8484
python -m pip install --no-deps dascore==0.0.8
8585
- uses: quarto-dev/quarto-actions/setup@v2
86+
with:
87+
version: "1.2.475"
8688
- name: Build docs
8789
run: |
8890
make docs-build

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ docs/examples/%: examples/%/_site
1313
rm -rf docs/examples/$*
1414
cp -rv $< $@
1515

16-
docs-build-examples: docs/examples/single-page docs/examples/pkgdown docs/examples/shiny
16+
docs-build-examples: docs/examples/single-page docs/examples/pkgdown
1717

1818
docs-build: docs-build-examples
1919
cd docs && quarto add --no-prompt ..

docs/_quarto.yml

Lines changed: 90 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ project:
44
resources:
55
- examples/single-page
66
- examples/pkgdown
7-
- examples/shiny
87

98
metadata-files:
109
- api/_sidebar.yml
@@ -19,16 +18,75 @@ interlinks:
1918
griffe:
2019
url: https://mkdocstrings.github.io/griffe/
2120

21+
website:
22+
title: "quartodoc"
23+
page-navigation: true
24+
navbar:
25+
left:
26+
- file: get-started/overview.qmd
27+
text: Get Started
28+
- file: examples/
29+
text: Examples
30+
- href: api/
31+
text: Reference
32+
right:
33+
- icon: github
34+
href: https://github.com/machow/quartodoc/
35+
sidebar:
36+
- id: get-started
37+
title: Get Started
38+
style: floating
39+
align: left
40+
contents:
41+
- get-started/overview.qmd
42+
- section: "Basic Use"
43+
contents:
44+
- get-started/basic-docs.qmd
45+
- get-started/basic-content.qmd
46+
- get-started/basic-building.qmd
47+
- get-started/crossrefs.qmd
48+
- get-started/interlinks.qmd
49+
- get-started/sidebar.qmd
50+
- get-started/extending.qmd
51+
52+
- section: "Docstrings"
53+
contents:
54+
- get-started/docstring-style.qmd
55+
- get-started/docstring-examples.qmd
56+
57+
- section: "Programming"
58+
contents:
59+
- get-started/dev-big-picture.qmd
60+
- get-started/dev-prepare.qmd
61+
- get-started/docstrings.qmd
62+
- get-started/renderers.qmd
63+
- get-started/dev-dataclasses.qmd
64+
- section: "Extra Topics"
65+
contents:
66+
- get-started/extra-build-sequence.qmd
67+
68+
69+
format:
70+
html:
71+
theme: cosmo
72+
css: styles.css
73+
toc: true
74+
75+
2276
quartodoc:
2377
style: pkgdown
2478
dir: api
2579
package: quartodoc
2680
sidebar: "api/_sidebar.yml"
2781
sections:
28-
- title: Inspection
82+
- title: Preperation Functions
2983
desc: |
30-
These functions Fetch and analyze python objects, including parsing docstrings.
84+
These functions fetch and analyze python objects, including parsing docstrings.
85+
They prepare a basic representation of your doc site that can be rendered and built.
3186
contents:
87+
- Auto
88+
- blueprint
89+
- collect
3290
- get_object
3391
- preview
3492

@@ -57,12 +115,12 @@ quartodoc:
57115
- kind: auto
58116
name: Builder
59117
members: []
118+
- Builder.from_quarto_config
60119
- Builder.build
61-
- Builder.do_blueprint
62-
- Builder.do_collect
63-
- Builder.do_summarize
64120
- Builder.write_index
65121
- Builder.write_doc_pages
122+
- Builder.write_sidebar
123+
- Builder.create_inventory
66124

67125

68126
- title: Inventory links
@@ -73,18 +131,28 @@ quartodoc:
73131
- create_inventory
74132
- convert_inventory
75133

76-
- title: Data models
134+
- title: "Data models: structural"
77135
desc: |
78-
Classes for specifying the exact layout of your docs.
136+
Classes for specifying the broad structure your docs.
79137
contents:
80138
- kind: "page"
81-
path: "layouts"
139+
path: "layouts-structure"
82140
flatten: true
83141
contents:
84142
- layout.Layout
85143
- layout.Section
86144
- layout.Page
87-
- layout.Auto
145+
- layout.SectionElement
146+
- layout.ContentElement
147+
148+
- title: "Data models: docable"
149+
desc: |
150+
Classes representing python objects to be rendered.
151+
contents:
152+
- kind: "page"
153+
path: "layouts-docable"
154+
flatten: true
155+
contents:
88156
- name: layout.Doc
89157
members: []
90158
- layout.DocFunction
@@ -93,50 +161,16 @@ quartodoc:
93161
- layout.DocClass
94162
- layout.Link
95163
- layout.Item
96-
- layout.SectionElement
97-
- layout.ContentElement
98-
99-
100-
website:
101-
title: "quartodoc"
102-
page-navigation: true
103-
navbar:
104-
left:
105-
- file: get-started/overview.qmd
106-
text: Get Started
107-
- file: examples/
108-
text: Examples
109-
- href: api/
110-
text: Reference
111-
right:
112-
- icon: github
113-
href: https://github.com/machow/quartodoc/
114-
sidebar:
115-
- id: get-started
116-
title: Get Started
117-
style: floating
118-
align: left
164+
- layout.ChoicesChildren
165+
- title: "Data models: docstring patches"
166+
desc: |
167+
Most of the classes for representing python objects live
168+
in [](`griffe.dataclasses`) or [](`griffe.docstrings.dataclasses`).
169+
However, the `quartodoc.ast` module has a number of custom classes to fill
170+
in support for some important docstring sections.
119171
contents:
120-
- get-started/overview.qmd
121-
- section: "Basics"
122-
contents:
123-
- get-started/basic-docs.qmd
124-
- get-started/crossrefs.qmd
125-
- get-started/interlinks.qmd
126-
- get-started/sidebar.qmd
127-
- get-started/extending.qmd
128-
- section: "Advanced"
129-
contents:
130-
- get-started/docstrings.qmd
131-
- get-started/renderers.qmd
132-
- get-started/building.qmd
133-
- section: "Extra Topics"
134-
contents:
135-
- get-started/architecture.qmd
136-
137-
138-
format:
139-
html:
140-
theme: cosmo
141-
css: styles.css
142-
toc: true
172+
- ast.DocstringSectionSeeAlso
173+
- ast.DocstringSectionNotes
174+
- ast.DocstringSectionWarnings
175+
- ast.ExampleCode
176+
- ast.ExampleText

docs/examples/index.qmd

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
1+
### Demo sites
2+
13
| style | source | layout |
24
| ----- | ------ | ------ |
35
| [pkgdown] | [github][pkgdown-code] | Index page with a title and short description for functions listed in each section. Each function gets its own documentation page. |
46
| [single-page] | [github][sp-code] | Index page has function documentation embedded on it. |
5-
| [shiny] | [github][shiny-code] | The shiny docs translated to quartodoc, using a custom renderer. |
7+
8+
### Packages using quartodoc
9+
10+
11+
| package | source | about |
12+
| ----- | ------ | ------ |
13+
| [siuba] | [github][sb-code] | Data analysis library. |
14+
| [shiny][shiny] | | Dashboarding framework. |
15+
| [vetiver][vetiver] | [github][vt-code] | A tool to version, share, deploy and monitor ML models. |
616

717
: {tbl-colwidths="[20, 20, 60]"}
818

919
[pkgdown]: /examples/pkgdown/reference
1020
[pkgdown-code]: https://github.com/machow/quartodoc/tree/main/examples/pkgdown
1121
[single-page]: /examples/single-page/reference
1222
[sp-code]: https://github.com/machow/quartodoc/tree/main/examples/single-page
13-
[shiny]: /examples/shiny/reference
14-
[shiny-code]: https://github.com/machow/quartodoc/tree/main/examples/shiny
23+
[shiny]: https://shiny.rstudio.com/py/api/
24+
[vetiver]: https://rstudio.github.io/vetiver-python/stable/reference/
25+
[vt-code]: https://github.com/rstudio/vetiver-python
26+
[siuba]: https://siuba.org/api/
27+
[sb-code]: https://github.com/machow/siuba.org
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: Advanced layouts
3+
jupyter:
4+
kernelspec:
5+
display_name: Python 3 (ipykernel)
6+
language: python
7+
name: python3
8+
---
9+
10+
## Pages
11+
12+
## Children options
13+
14+
##
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
---
2+
title: Building and debugging docs
3+
jupyter:
4+
kernelspec:
5+
display_name: Python 3 (ipykernel)
6+
language: python
7+
name: python3
8+
---
9+
10+
**tl;dr**: Once you've configured quartodoc in your `_quarto.yml` file, use the following commands to build and preview a documentation site.
11+
12+
```bash
13+
# Create the documentation files. These are written
14+
# by default to the reference/ folder in your docs.
15+
quartodoc build --verbose
16+
17+
# Create optional inventory files, which allow you to
18+
# link to API doc pages within and across documentation
19+
# sites. These are put in the _inv folder in your docs.
20+
quartodoc interlinks
21+
22+
# Preview the documentation site.
23+
# Use quarto render to generate the final site.
24+
quarto preview
25+
```
26+
27+
## Rebuilding doc pages
28+
29+
While using `quarto preview`, you can preview updates to your docstrings by regenerating their documentation pages:
30+
31+
```bash
32+
quartodoc build --verbose
33+
```
34+
35+
## Speeding up preview
36+
37+
### Rewriting doc files
38+
39+
By default, the `quartodoc build` only re-writes doc pages when it detects
40+
a change to their content. This helps prevent `quarto preview` from trying
41+
to re-render every doc page--including those that haven't changed.
42+
43+
### Selectively building doc pages
44+
45+
Use the filter option with `quartodoc build` to generate a subset of doc pages.
46+
This is useful when you have a many (e.g. several hundred) doc pages, and want
47+
to test a change on a single page.
48+
49+
```bash
50+
quartodoc build --filter 'get_object'
51+
```
52+
53+
This option also accepts a wildcard pattern, which causes it to build docs for all matching objects.
54+
55+
```bash
56+
# write the docs for the MdRenderer class, and any of its methods
57+
# (e.g. MdRenderer.renderer)
58+
quartodoc build --filter 'MdRenderer*'
59+
```
60+
61+
:::{.callout-note}
62+
When using a name with a wildcard, be sure to put it in single quotes!
63+
Otherwise, your shell may try to "expand it" to match file names.
64+
:::

0 commit comments

Comments
 (0)