Skip to content

Commit f0e57de

Browse files
committed
docs: fix examples
1 parent 461ce66 commit f0e57de

File tree

12 files changed

+177
-1
lines changed

12 files changed

+177
-1
lines changed

Makefile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
README.md: README.qmd
22
quarto render $<
33

4-
docs-build:
4+
examples/%/_site: examples/%/_quarto.yml
5+
quarto render $(dir $<)
6+
7+
docs/examples/%: examples/%/_site
8+
rm -rf docs/examples/$*
9+
cp -rv $< $@
10+
11+
docs-build: docs/examples/single-page docs/examples/pkgdown
512
cd docs && quarto add --no-prompt ..
613
cd docs && python -m quartodoc
714
quarto render docs

docs/_quarto.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ project:
33
output-dir: _build
44
resources:
55
- objects.json
6+
- examples/single-page
7+
- examples/pkgdown
68
#pre-render: "python -m quartodoc _quarto.yml"
79

810
filters:
@@ -59,6 +61,8 @@ website:
5961
left:
6062
- file: get-started/overview.qmd
6163
text: Get Started
64+
- file: examples/
65+
text: Examples
6266
- href: api/
6367
text: Reference
6468
right:

examples/pkgdown/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.quarto/
2+
3+
_site

examples/pkgdown/_quarto.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
project:
2+
type: website
3+
resources:
4+
- objects.json
5+
6+
website:
7+
navbar:
8+
left:
9+
- href: https://machow.github.io/quartodoc/
10+
text: quartodoc home
11+
- file: reference/index.qmd
12+
text: "Reference"
13+
right:
14+
- icon: github
15+
href: https://github.com/machow/quartodoc/tree/main/examples/pkgdown
16+
17+
18+
19+
quartodoc:
20+
style: pkgdown
21+
dir: reference
22+
package: quartodoc
23+
sections:
24+
- title: Some functions
25+
desc: These functions inspect and parse docstrings.
26+
contents:
27+
- get_object
28+
- preview

examples/pkgdown/objects.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"project": "quartodoc", "version": "0.0.9999", "count": 2, "items": [{"name": "quartodoc.get_object", "domain": "py", "role": "function", "priority": "1", "uri": "reference/get_object.html", "dispname": "get_object"}, {"name": "quartodoc.preview", "domain": "py", "role": "function", "priority": "1", "uri": "reference/preview.html", "dispname": "preview"}]}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
## get_object { #get_object }
2+
3+
`get_object(module: str, object_name: str, parser: str = 'numpy')`
4+
5+
Fetch a griffe object.
6+
7+
### Parameters
8+
9+
| Name | Type | Description | Default |
10+
|---------------|--------|----------------------------|-----------|
11+
| `module` | str | A module name. | required |
12+
| `object_name` | str | A function name. | required |
13+
| `parser` | str | A docstring parser to use. | `'numpy'` |
14+
15+
See Also
16+
--------
17+
get_function: a deprecated function.
18+
19+
### Examples
20+
21+
```python
22+
>>> get_function("quartodoc", "get_function")
23+
<Function('get_function', ...
24+
```
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Function reference
2+
3+
## Some functions
4+
5+
These functions inspect and parse docstrings.
6+
7+
| | |
8+
| --- | --- |
9+
| [get_object](/reference/get_object.qmd) | Fetch a griffe object. |
10+
| [preview](/reference/preview.qmd) | Print a friendly representation of a griffe object (e.g. function, docstring) |
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## preview { #preview }
2+
3+
`preview(ast: dc.Object | ds.Docstring | object)`
4+
5+
Print a friendly representation of a griffe object (e.g. function, docstring)
6+
7+
### Examples
8+
9+
```python
10+
>>> from quartodoc import get_object
11+
>>> obj = get_object("quartodoc", "get_object")
12+
```
13+
14+
```python
15+
>>> preview(obj.docstring.parsed)
16+
...
17+
```
18+
19+
```python
20+
>>> preview(obj)
21+
...
22+
```

examples/single-page/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/.quarto/
2+
3+
_site

examples/single-page/_quarto.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
project:
2+
type: website
3+
resources:
4+
- objects.json
5+
6+
website:
7+
navbar:
8+
left:
9+
- href: https://machow.github.io/quartodoc/
10+
text: quartodoc home
11+
- file: reference/index.qmd
12+
text: "Reference"
13+
right:
14+
- icon: github
15+
href: https://github.com/machow/quartodoc/tree/main/examples/single-page
16+
17+
quartodoc:
18+
style: single-page
19+
dir: reference
20+
package: quartodoc
21+
sections:
22+
- title: Some functions
23+
desc: These functions inspect and parse docstrings.
24+
contents:
25+
- get_object
26+
- preview

0 commit comments

Comments
 (0)