Skip to content

Commit 349ecab

Browse files
committed
docs: document options block
1 parent 5925733 commit 349ecab

File tree

1 file changed

+121
-64
lines changed

1 file changed

+121
-64
lines changed

docs/get-started/basic-content.qmd

Lines changed: 121 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,127 @@ quartodoc:
9999
children: separate
100100
```
101101

102+
103+
## Setting default options
104+
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.
107+
108+
Use the `options:` field in a section to specify options to apply across all content in that section.
109+
110+
For example, the config blocks below show how to document multiple classes without their members.
111+
112+
:::::: {.columns}
113+
::: {.column}
114+
115+
**Manual**
116+
117+
```yaml
118+
quartodoc:
119+
package: quartodoc
120+
sections:
121+
- title: "Some section"
122+
123+
# options set manually ---
124+
contents:
125+
- name: MdRenderer
126+
members: []
127+
- name: Builder
128+
members: []
129+
```
130+
131+
:::
132+
::: {.column}
133+
134+
**With options**
135+
136+
```yaml
137+
quartodoc:
138+
package: quartodoc
139+
sections:
140+
- title: "Some section"
141+
142+
# default options ---
143+
options:
144+
members: []
145+
146+
contents:
147+
- MdRenderer
148+
- Builder
149+
```
150+
151+
:::
152+
::::::
153+
154+
Note that the **with options** block sets `members: []` inside `options`.
155+
This sets `members: []` as the default for each piece of content.
156+
157+
## Specifying package path
158+
159+
Different levels of configuration let you set the `package` option.
160+
This controls the package path that quartodoc will try to import control content from.
161+
162+
The example below shows three different places it can be set:
163+
top-level site config, section config, or in a page element.
164+
165+
```yaml
166+
# (1) package set on top-level site config
167+
quartodoc:
168+
package: quartodoc
169+
sections:
170+
- title: ""
171+
desc: ""
172+
contents:
173+
- get_object # quartodoc.get_object
174+
175+
# (2) package set on a section
176+
- title: ""
177+
desc: ""
178+
package: quartodoc.ast
179+
contents:
180+
- preview # quartodoc.ast.preview
181+
182+
# (3) package set on a page
183+
- kind: page
184+
package: pandas
185+
contents:
186+
- DataFrame # pandas.DataFrame
187+
188+
# (4) package set on individual content entry
189+
- package: pandas
190+
name: Series
191+
```
192+
193+
Use `package: null` to unset the package option. This enables you to specify objects using their full name.
194+
195+
```yaml
196+
quartodoc:
197+
package: quartodoc
198+
sections:
199+
- title: ""
200+
desc: ""
201+
package: null
202+
contents:
203+
- quartodoc.get_object
204+
```
205+
206+
207+
## Dynamic lookup
208+
209+
By default, quartodoc uses static analysis to look up objects.
210+
This means it gets information about your docstring without actually running your package's code.
211+
212+
This usually works well, but may get the docstring wrong for those created in an extremely dynamic way (e.g. you manually set the `__doc__` attribute on an object).
213+
214+
In this case, you can set the dynamic option on a piece of content.
215+
216+
```yaml
217+
contents:
218+
- name: get_object
219+
dynamic: true
220+
```
221+
222+
102223
## Reference page sub-sections
103224

104225
quartodoc supports two levels of grouping on the reference page.
@@ -210,67 +331,3 @@ Note these three important pieces of the page entry:
210331
* `contents:` - lists out the contents of the page.
211332

212333

213-
214-
## Setting default package path
215-
216-
Different levels of configuration let you set the `package` option.
217-
This controls the package path that quartodoc will try to import control content from.
218-
219-
The example below shows three different places it can be set:
220-
top-level site config, section config, or in a page element.
221-
222-
```yaml
223-
# (1) package set on top-level site config
224-
quartodoc:
225-
package: quartodoc
226-
sections:
227-
- title: ""
228-
desc: ""
229-
contents:
230-
- get_object # quartodoc.get_object
231-
232-
# (2) package set on a section
233-
- title: ""
234-
desc: ""
235-
package: quartodoc.ast
236-
contents:
237-
- preview # quartodoc.ast.preview
238-
239-
# (3) package set on a page
240-
- kind: page
241-
package: pandas
242-
contents:
243-
- DataFrame # pandas.DataFrame
244-
245-
# (4) package set on individual content entry
246-
- package: pandas
247-
name: Series
248-
```
249-
250-
Use `package: null` to unset the package option. This enables you to specify objects using their full name.
251-
252-
```yaml
253-
quartodoc:
254-
package: quartodoc
255-
sections:
256-
- title: ""
257-
desc: ""
258-
package: null
259-
contents:
260-
- quartodoc.get_object
261-
```
262-
263-
## Dynamic lookup
264-
265-
By default, quartodoc uses static analysis to look up objects.
266-
This means it gets information about your docstring without actually running your package's code.
267-
268-
This usually works well, but may get the docstring wrong for those created in an extremely dynamic way (e.g. you manually set the `__doc__` attribute on an object).
269-
270-
In this case, you can set the dynamic option on a piece of content.
271-
272-
```yaml
273-
contents:
274-
- name: get_object
275-
dynamic: true
276-
```

0 commit comments

Comments
 (0)