Skip to content

Commit 5a99ef9

Browse files
committed
update docs, remove objects.json
1 parent 63a6318 commit 5a99ef9

File tree

4 files changed

+42
-112
lines changed

4 files changed

+42
-112
lines changed

docs/api/index.md

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

docs/get-started/crossrefs.qmd

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,6 @@ Coming soon!
1919
| rst | default | `` :ref:`quartodoc.get_object` `` | :ref:`quartodoc.get_object` |
2020
| rst | shortened | `` :ref:`~quartodoc.get_object` `` | :ref:`~quartodoc.get_object` |
2121

22-
## Link within a doc
23-
24-
* `@sec-get_object` doesn't seem to work: @sec-get-_object.
25-
* [get_object](/api/#sec-get_object)
2622

2723
## Link to external docs
2824

docs/get-started/docstrings.qmd

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,25 @@ jupyter:
99

1010
quartodoc uses the library [griffe](https://github.com/mkdocstrings/griffe) to load and parse docstrings.
1111

12+
## Docstring structure
13+
14+
quartodoc currently expects docstrings to be in the [numpydocstring](https://numpydoc.readthedocs.io/en/latest/format.html) format.
15+
16+
Docstrings are loaded and parsed using [griffe](https://mkdocstrings.github.io/griffe),
17+
which uses custom data classes to represent the structure of a program:
18+
19+
- [griffe.dataclasses](https://mkdocstrings.github.io/griffe/reference/griffe/dataclasses/#griffe.dataclasses) - represent the structure of python objects.
20+
- [griffe.docstrings.dataclasses](https://mkdocstrings.github.io/griffe/reference/griffe/docstrings/dataclasses/#griffe.docstrings.dataclasses) - represent the structure of parsed docstrings.
21+
22+
23+
1224
## Reading docstrings
1325

1426
Use the function [get_object](/api/#get_object) to read in a docstring from a module.
1527

1628

1729
```{python}
18-
from quartodoc import get_object
30+
from quartodoc import get_object, preview
1931
2032
f_obj = get_object("quartodoc", "get_object")
2133
f_obj
@@ -56,13 +68,29 @@ f_obj.docstring.parsed
5668
The docstring into a tree lets us define visitors, which can visit each element and
5769
do useful things. For example, print a high-level overview of its structure, or render it to markdown.
5870

59-
## Parsed docstring structure
71+
## Previewing docstrings
72+
73+
Use the preview function to see the overall structure of a parsed docstring.
74+
75+
```{python}
76+
from quartodoc import get_object, preview
77+
78+
f_obj = get_object("quartodoc", "get_object")
79+
```
80+
81+
### Raw docstring
82+
83+
84+
```{python}
85+
print(f_obj.docstring.value)
86+
```
87+
88+
### Preview
6089

61-
* [numpydocstring](https://numpydoc.readthedocs.io/en/latest/format.html) - defines the numpydoc format for writing docstrings.
62-
* griffe modules for representing docstrings:
63-
- [griffe.dataclasses](https://mkdocstrings.github.io/griffe/reference/griffe/dataclasses/#griffe.dataclasses)
64-
- [griffe.docstrings.dataclasses](https://mkdocstrings.github.io/griffe/reference/griffe/docstrings/dataclasses/#griffe.docstrings.dataclasses)
6590

91+
```{python}
92+
preview(f_obj.docstring.parsed)
93+
```
6694

6795
## Rendering docstrings
6896

@@ -110,3 +138,11 @@ Note 3 big pieces:
110138
* **Tree walking**: `visit` methods often call `visit` again on sub elements.
111139

112140

141+
## Parsing other docstring formats
142+
143+
Currently, quartodoc expects docstrings in the numpydoc format.
144+
However, the tool it uses under the hood (griffe) is easy to customize, and supports multiple formats.
145+
146+
See the griffe [loading docs](https://mkdocstrings.github.io/griffe/loading/) for instructions.
147+
Specifically, the [GriffeLoader](https://mkdocstrings.github.io/griffe/reference/griffe/loader/#griffe.loader.GriffeLoader) takes options for customizing docstring parsing.
148+

docs/objects.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)