Skip to content

Commit 01c91fb

Browse files
committed
docs: add many pages to get started
1 parent accc4d5 commit 01c91fb

12 files changed

+426
-215
lines changed

docs/_quarto.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,25 @@ website:
3939
align: left
4040
contents:
4141
- get-started/overview.qmd
42-
- section: "Basics"
42+
- section: "Basic Use"
4343
contents:
4444
- get-started/basic-docs.qmd
45+
- get-started/basic-building.qmd
4546
- get-started/crossrefs.qmd
4647
- get-started/interlinks.qmd
4748
- get-started/sidebar.qmd
48-
- get-started/extending.qmd
4949
- get-started/advanced-layouts.qmd
50+
- get-started/extending.qmd
5051

51-
- section: "Advanced"
52+
- section: "Programming"
5253
contents:
54+
- get-started/dev-big-picture.qmd
55+
- get-started/dev-prepare.qmd
5356
- get-started/docstrings.qmd
5457
- get-started/renderers.qmd
55-
- get-started/building.qmd
56-
- get-started/dev-blueprints.qmd
5758
- section: "Extra Topics"
5859
contents:
59-
- get-started/architecture.qmd
60+
- get-started/extra-build-sequence.qmd
6061

6162

6263
format:
@@ -154,6 +155,7 @@ quartodoc:
154155
- layout.DocClass
155156
- layout.Link
156157
- layout.Item
158+
- layout.ChoicesChildren
157159
- title: "Data models: AST patches"
158160
desc: |
159161
Most of the classes for representing python objects live

docs/examples/index.qmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,12 @@
22
| ----- | ------ | ------ |
33
| [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. |
44
| [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. |
5+
| [shiny] | private repository | The shiny docs translated to quartodoc, using a custom renderer. |
66

77
: {tbl-colwidths="[20, 20, 60]"}
88

99
[pkgdown]: /examples/pkgdown/reference
1010
[pkgdown-code]: https://github.com/machow/quartodoc/tree/main/examples/pkgdown
1111
[single-page]: /examples/single-page/reference
1212
[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
13+
[shiny]: https://shiny.rstudio.com/py/api/
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: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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+
Basic commands:
11+
12+
* quartodoc build --verbose
13+
* quartodoc interlinks
14+
* quarto preview
15+
16+
Extra
17+
18+
* note the write only on change option
19+
* if in trouble, point to advanced section for loading things in python
20+
* what if my docstring looks weird? (style vs renderer etc..)

docs/get-started/basic-docs.qmd

Lines changed: 85 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ jupyter:
77
name: python3
88
---
99

10-
## Adding configuration
10+
## Site configuration
1111

1212
quartodoc is configured by adding a `quartodoc` section to your `_quarto.yml`:
1313

1414
```yaml
1515
quartodoc:
16-
style: single-page
16+
style: pkgdown
1717
dir: reference
1818
package: quartodoc
1919
sections:
@@ -24,7 +24,7 @@ quartodoc:
2424
- preview
2525
```
2626
27-
## Top-level options
27+
### Top-level options
2828
2929
The `quartodoc` section takes a `style` field, specifying which [](`quartodoc.Builder`)
3030
to use (currently "pkgdown" or "single-page"; see [Examples](/examples/)).
@@ -42,41 +42,104 @@ doc_params = [entry for entry in doc_parts if entry.kind.name == "parameters"][0
4242
print(renderer.render(doc_params))
4343
```
4444

45-
## Section options
45+
### Section options
4646

4747
The `sections` field defines which functions to document.
4848

49-
| Name | Type | Description |
50-
| ---- | ---- | ----------- |
51-
| title | str | A title for the section |
52-
| desc | str | A description for the section |
53-
| contents | list[str] | A list of functions to document |
49+
It requires three pieces of configuration:
5450

51+
* title: a title for the section
52+
* desc: a description for the section
53+
* contents: a list of functions to document
5554

56-
## Looking up functions
55+
## Content configuration
5756

58-
Finding functions to document involves two pieces of configuration:
57+
Individual content entries (e.g. a function to be documented) can also be customized.
58+
For example, if you are documenting a python class, you may want to include or exclude
59+
documentation on specific methods on that class.
60+
61+
Specify content options by setting `name: <content name>`, along with any additional options.
62+
63+
For example, below is a piece of content, MdRenderer, specified without options.
64+
65+
```yaml
66+
contents:
67+
- MdRenderer
68+
```
69+
70+
We set it to only document its render method, by setting `name: MdRenderer` followed by the
71+
`members` option.
72+
73+
```yaml
74+
contents:
75+
- name: MdRenderer
76+
members:
77+
- render
78+
```
79+
80+
TODO: kinds of content, link to advanced layouts
81+
82+
## Looking up objects
83+
84+
Finding python objects to document involves two pieces of configuration:
5985

6086
* the package name.
61-
* a list of functions for content.
87+
* a list of objects for content.
88+
89+
Note that quartodoc can look up anything---whether functions, modules, classes, attributes, or methods.
6290

6391
```yaml
6492
quartodoc:
6593
package: quartodoc
6694
sections:
67-
- contents:
68-
# top-level function: quartodoc.get_object
69-
- get_object
95+
- title: Some section
96+
desc: ""
97+
contents:
98+
- get_object # function: quartodoc.get_object
99+
- ast.preview # submodule func: quartodoc.ast.preview
100+
- MdRenderer # class: quartodoc.MdRenderer
101+
- MdRenderer.render # method: quartodoc.MDRenderer.render
102+
- renderers # module: quartodoc.renderers
103+
```
104+
105+
The functions listed in `contents` are assumed to be imported from the package.
106+
107+
## Module and class members
108+
109+
Documentation for modules and classes can automatically include their members (e.g. class methods and attributes; everything defined inside a module).
70110

71-
# top-level class: quartodoc.MdRenderer
72-
- MdRenderer
111+
There are four styles for presenting child members:
112+
113+
```{python}
114+
#| echo: false
115+
#| output: asis
116+
117+
# print out the attributes table of ChoicesChildren
118+
# this is overkill, but maybe a nice case of dogfooding
119+
from quartodoc import get_object, MdRenderer
120+
from quartodoc.builder.utils import extract_type
121+
from griffe.docstrings.dataclasses import DocstringSectionAttributes
73122
74-
# submodule function: quartodoc.ast.preview
75-
- ast.preview
123+
renderer = MdRenderer()
124+
choices = get_object("quartodoc.layout.ChoicesChildren")
125+
res = extract_type(DocstringSectionAttributes, choices.docstring.parsed)[0]
126+
127+
print(renderer.render(res))
76128
```
77129

78-
The functions listed in `contents` are assumed to be imported from the package.
130+
You can specify a style by setting the `children` option in the config:
79131

80-
### Class methods
132+
```yaml
133+
quartodoc:
134+
package: quartodoc
135+
sections:
136+
- title: Some section
137+
desc: ""
138+
contents:
81139
82-
Currently, quartodoc can't look up class methods. (Though this would be quick to implement!).
140+
# set the children option, so that methods get documented
141+
# on separate pages. MdRenderer's docs will include a summary
142+
# table that links to each page.
143+
- name: quartodoc.MdRenderer
144+
children: separate
145+
```

docs/get-started/building.qmd

Lines changed: 0 additions & 106 deletions
This file was deleted.

0 commit comments

Comments
 (0)