You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/get-started/dev-prepare.qmd
+68-25Lines changed: 68 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,6 @@ jupyter:
16
16
```{python}
17
17
from quartodoc import collect, preview
18
18
from quartodoc import MdRenderer
19
-
from quartodoc import layout
20
19
import yaml
21
20
```
22
21
@@ -55,7 +54,8 @@ We can see many of the configuration options such as `members`, `name` and `chil
55
54
However, we don't have to start with `yaml` files to create an `Auto` object. We can also create an `Auto` object with the fully qualified name of any Python object. For example, we can create an `Auto` object for the `MdRenderer` class like this:
56
55
```{python}
57
56
from quartodoc import Auto
58
-
auto = Auto(name = "quartodoc.MdRenderer", signature_name = 'short')
The [](`~quartodoc.layout.Layout`) class stores how you wish to organize your documentation. For example, you may wish to organize your documentation into sections, where each section contains a title, description, and a list of objects to document. You can create a layout like this:
As you can see, the `Layout` stores the sections, which are stored in the `sections` attribute. Each section contains a `title`, `desc`, and `contents` attribute and is stored in a [](`~quartodoc.layout.Section`) class.
153
+
154
+
The `contents` attribute is a list of objects to document. In this case, the first section contains a single object, the `MdRenderer` class, while the second section contains two objects. You can read more about Section options [here](basic-docs.qmd#section-options).
155
+
156
+
In addition to building a layout from a yaml file, you can also build a layout in Python by instantiating the `Layout` class like so:
157
+
158
+
```{python}
159
+
from quartodoc import Auto, layout
160
+
161
+
auto = Auto(name = "quartodoc.MdRenderer",
162
+
signature_name = 'short')
163
+
127
164
lay = layout.Layout(
128
165
sections = [
129
-
layout.Section(title = "A section", desc = "A description", contents = [auto])
166
+
layout.Section(title = "A section",
167
+
desc = "A description",
168
+
contents = [auto])
130
169
]
131
170
)
132
171
```
133
172
134
-
135
-
:::::: {.columns}
136
-
137
-
::: {.column}
173
+
We can view the layout by calling the `preview` function:
138
174
139
175
```{python}
140
-
# raw layout
141
-
preview(lay, compact=True)
176
+
preview(lay,
177
+
max_depth=8,
178
+
compact=True)
142
179
```
143
180
144
-
:::
145
-
::: {.column}
146
-
181
+
Recall that the `blueprint` function parses all of the metadata about the Python object. We can see how a blueprint adds additional data pertaining to `MdRenderer`, that wasn't present in the layout above:
147
182
```{python}
148
-
bp_layout = blueprint(lay)
149
-
preview(bp_layout, max_depth=5, compact=True)
183
+
bp_layout = blueprint(lay)
184
+
preview(bp_layout,
185
+
max_depth=8,
186
+
compact=True)
150
187
```
151
188
152
-
:::
153
189
154
-
::::::
190
+
### Grouping docs on a page
155
191
156
-
### Grouping docs on single Page
192
+
The Layout also calculates how to split your sections into pages based on the options you set in your yaml configuration. For example, if you set the `children` option to `separate`, then each object in a section will be placed on its own page.
157
193
158
-
### Class members
194
+
Let's see the difference between the `separate` and `embedded` options by creating two `Auto` objects for the `MdRenderer` class, one with `children` set to `separate` and the other with `children` set to `embedded`:
159
195
160
196
```{python}
161
-
auto_separate = layout.Auto(name = "quartodoc.MdRenderer", children = "separate")
162
-
auto_embedded = layout.Auto(name = "quartodoc.MdRenderer", children = "embedded")
0 commit comments