Skip to content

Commit b86392d

Browse files
authored
Merge pull request #264 from machow/docs-review
Docs review
2 parents 94cc9bc + 393de6f commit b86392d

File tree

5 files changed

+210
-89
lines changed

5 files changed

+210
-89
lines changed

docs/_quarto.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,9 +83,9 @@ quartodoc:
8383
render_interlinks: true
8484
sidebar: "api/_sidebar.yml"
8585
sections:
86-
- title: Preperation Functions
86+
- title: Preparation Functions
8787
desc: |
88-
These functions fetch and analyze python objects, including parsing docstrings.
88+
These functions fetch and analyze Python objects, including parsing docstrings.
8989
They prepare a basic representation of your doc site that can be rendered and built.
9090
contents:
9191
- Auto
@@ -123,10 +123,9 @@ quartodoc:
123123
- Builder.write_sidebar
124124
- Builder.create_inventory
125125

126-
127126
- title: Inventory links
128127
desc: |
129-
Inventory files map a functions name to its corresponding url in your docs.
128+
Inventory files map a function's name to its corresponding url in your docs.
130129
These functions allow you to create and transform inventory files.
131130
contents:
132131
- create_inventory

docs/get-started/basic-content.qmd

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,20 @@ jupyter:
77
name: python3
88
---
99

10-
Individual content entries (e.g. a function to be documented) can also be customized.
10+
Individual content entries (e.g. a function to be documented) can be customized.
1111
For example, if you are documenting a Python class, you may want to include or exclude
1212
documentation on specific methods on that class.
1313

14-
Specify content options by setting `name: <content name>`, along with any additional options.
14+
Specify content options by setting `name: <content name>` followed by any additional options.
1515

16-
For example, below is a piece of content, MdRenderer, specified without options.
16+
For example, below is a single content element, `MdRenderer`, without additional options.
1717

1818
```yaml
1919
contents:
2020
- MdRenderer
2121
```
2222
23-
We set it to only document its render method, by setting `name: MdRenderer` followed by the `members` option.
23+
Instead of documenting the entire `MdRenderer` class, we can only document the `MdRenderer.render` method by setting `name: MdRenderer` followed by the `members` option:
2424

2525
```yaml
2626
contents:
@@ -36,10 +36,10 @@ In the following sections, we'll discuss different options for configuring conte
3636

3737
Finding Python objects to document involves two pieces of configuration:
3838

39-
* the package name.
40-
* a list of objects for content.
39+
1. the package name.
40+
2. a list of objects for content.
4141

42-
Note that quartodoc can look up anything---whether functions, modules, classes, attributes, or methods.
42+
quartodoc can look up a wide variety of objects, including functions, modules, classes, attributes, and methods:
4343

4444
```yaml
4545
quartodoc:
@@ -55,13 +55,13 @@ quartodoc:
5555
- renderers # module: quartodoc.renderers
5656
```
5757

58-
The functions listed in `contents` are assumed to be imported from the package.
58+
The functions listed in `contents` are those that are available for import from the package (`quartodoc` in this instance).
5959

6060
## Module and class members
6161

62-
Documentation for modules and classes can automatically include their members (e.g. class methods and attributes; everything defined inside a module).
62+
Documentation for classes and modules can automatically include their members (e.g. class methods and attributes or everything defined inside a module, respectively).
6363

64-
By default, all attributes and functions (including methods on a class) are documented by embedding them inside the module or class documentation.
64+
By default, all attributes and functions (including methods on a class) are presented in the `embedded` style, which means their documentation is located inside their respective module's or class's documentation.
6565

6666
There are four styles for presenting child members:
6767

@@ -82,7 +82,7 @@ res = extract_type(DocstringSectionAttributes, choices.docstring.parsed)[0]
8282
print(renderer.render(res))
8383
```
8484

85-
You can specify a style by setting the `children` option in the config:
85+
You can specify a style for displaying members by setting the `children` option in the config:
8686

8787
```yaml
8888
quartodoc:
@@ -102,12 +102,11 @@ quartodoc:
102102

103103
## Setting default options
104104

105-
The section above showed how you can set options like `members:` and `children:` on content.
106-
When specifying API documentation, you may need to specify the same options across multiple pieces of content.
105+
The section above showed how you can set options like `members:` (which is a list of the items you want to show) and `children:` (the style for presenting `members`) on content.
107106

108-
Use the `options:` field in a section to specify options to apply across all content in that section.
107+
However, you may desire to set the same options across multiple pieces of content. In this case, you can set default options for a section that applies to all content in that section. You can use the `options:` field to accomplish this.
109108

110-
For example, the config blocks below show how to document multiple classes without their members.
109+
For example, the config below shows how to document multiple classes _without_ any child members. On the left, you can see the config without setting the default option, and on the right, you can see the config with the default option set.
111110

112111
:::::: {.columns}
113112
::: {.column}
@@ -151,12 +150,11 @@ quartodoc:
151150
:::
152151
::::::
153152

154-
Note that the **with options** block sets `members: []` inside `options`.
155-
This sets `members: []` as the default for each piece of content.
153+
By setting `members: []` in the options block, we are telling quartodoc to not include any members for each piece of content.
156154

157155
### Reusing options
158156

159-
Options can be given a name, and re-used in multiple sections:
157+
Options can be given a name and re-used in multiple sections:
160158

161159
```yaml
162160
- title: Some section

docs/get-started/dev-big-picture.qmd

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The code below shows a Builder object being loaded from a `_quarto.yml` config (
2828
```{python}
2929
import yaml
3030
31-
from quartodoc import Builder, preview, blueprint, collect, MdRenderer
31+
from quartodoc import Builder, blueprint, collect, MdRenderer
3232
3333
cfg = yaml.safe_load("""
3434
quartodoc:
@@ -48,7 +48,7 @@ builder
4848
```
4949

5050
Note that .from_quarto_config used the `style:` field to decide which Builder to create
51-
(in this case, PkgdownBuilder).
51+
(in this case, `BuilderPkgdown`).
5252

5353
We can view the config as a [layout.Layout](`quartodoc.layout.Layout`), by looking at the `.layout` attribute.
5454

@@ -59,6 +59,7 @@ builder.layout
5959
This can be a bit difficult to read, so quartodoc implements a [preview](`quartodoc.preview`) function, which spaces things out.
6060

6161
```{python}
62+
from quartodoc import preview
6263
preview(builder.layout)
6364
```
6465

@@ -69,14 +70,14 @@ a pipe connecting it to each of its arguments.
6970
* The content entry `MdRenderer` is represented by an [Auto](`quartodoc.Auto`) class.
7071
This specifies a Python object to look up and document.
7172

72-
We can follow the path in the preview above, to pull out just the contents piece:
73+
We can follow the path in the preview above, to pull out just this first piece of content containing `MdRenderer`:
7374

7475
```{python}
7576
content = builder.layout.sections[0].contents[0]
7677
preview(content)
7778
```
7879

79-
Next, we'll look at `blueprint()`, which processes the layout, including transforming `Auto` objects into more concrete instructions.
80+
Next, we'll look at `blueprint()`, which processes the layout, including transforming `Auto` objects (like the one representing the `MdRenderer` above) into more concrete instructions.
8081

8182
## From config to blueprint
8283

@@ -96,7 +97,7 @@ Notice two key pieces:
9697
This element holds everything needed to render this doc, including the class signature
9798
and parsed docstring.
9899

99-
Importantly, the `.members` attribute specifies how to render the class methods we specified (`.render()` and `.summarize()`).
100+
Importantly, the `.members` attribute stores how to render the class methods we listed in our configuration yaml, `.render()` and `.summarize()`:
100101

101102
```{python}
102103
preview(bp_contents.contents[0].members, max_depth=2)
@@ -112,7 +113,7 @@ Before to building the site, we need to `collect()` all the pages.
112113
The [collect](`quartodoc.collect`) function pulls out two important pieces of information:
113114

114115
* **pages** - each page to be rendered.
115-
* **items** - information on where each documented object lives in the site.
116+
* **items** - information on where each documented object lives in the site, which is used for things like [interlinks](interlinks.qmd).
116117

117118
```{python}
118119
pages, items = collect(bp, builder.dir)
@@ -130,21 +131,28 @@ Notice that if you wanted to look up `quartodoc.MdRenderer.render`, the first it
130131

131132
## Rendering and writing
132133

133-
A `Builder` instantiates a `Renderer` (like [MdRenderer](`quartodoc.MdRenderer`)).
134-
Use the `.renderer` attribute to access it.
134+
A `Builder` instantiates a `Renderer` (like [](`~quartodoc.MdRenderer`)).
135+
Use the `.renderer` attribute to access it:
135136

136137
```{python}
137138
builder.renderer
138139
```
139140

141+
The `render` method of of the [](`~quartodoc.MdRenderer`) returns a markdown string that can be rendered by Quarto:
140142
```{python}
141143
print(builder.renderer.render(pages[0]))
142-
143144
```
144145

146+
:::{.callout-note}
147+
### Cross References
148+
149+
The `{ #quartodoc.MdRenderer.render }` in the output above is extended Quarto markdown that is a [cross reference](https://quarto.org/docs/authoring/cross-references.html).
150+
151+
:::
152+
145153
## Writing pages
146154

147-
The builder has a number of methods it uses during build.
155+
The builder has a number of methods it uses while materializing files that will be rendered by Quarto.
148156
The main method is [.build()](`quartodoc.Builder.build`).
149157
See the [Builder section of the API](#api-builders) for a list of methods,
150158
or this [giant build process diagram](/get-started/extra-build-sequence.qmd) for a full breakdown.

0 commit comments

Comments
 (0)