Skip to content

Commit 5fe3555

Browse files
committed
docs: add README.md rendered from homepage
1 parent 7b14fa8 commit 5fe3555

File tree

2 files changed

+156
-2
lines changed

2 files changed

+156
-2
lines changed

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,13 @@ docs/examples/%: examples/%/_site
3232

3333
docs-build-examples: docs/examples/single-page docs/examples/pkgdown docs/examples/auto-package
3434

35+
docs-build-readme: export BUILDING_README = 1
3536
docs-build-readme:
36-
BUILDING_README=1 cd docs \
37+
cd docs \
3738
&& quarto render get-started/overview.qmd \
3839
--to gfm \
39-
--output README.md
40+
--output README.md \
41+
--output-dir ..
4042

4143
docs-build: docs-build-examples
4244
cd docs && quarto add --no-prompt ..

README.md

Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
# Overview
2+
3+
**quartodoc** lets you quickly generate Python package API reference
4+
documentation using Markdown and [Quarto](https://quarto.org). quartodoc
5+
is designed as an alternative to
6+
[Sphinx](https://www.sphinx-doc.org/en/master/).
7+
8+
Check out the below screencast for a walkthrough of creating a
9+
documentation site, or read on for instructions.
10+
11+
<div>
12+
13+
[![](https://cdn.loom.com/sessions/thumbnails/fb4eb736848e470b8409ba46b514e2ed-00001.gif)](https://www.loom.com/share/fb4eb736848e470b8409ba46b514e2ed)
14+
15+
</div>
16+
17+
## Installation
18+
19+
``` bash
20+
python -m pip install quartodoc
21+
```
22+
23+
or from GitHub
24+
25+
``` bash
26+
python -m pip install git+https://github.com/machow/quartodoc.git
27+
```
28+
29+
<div>
30+
31+
> **Install Quarto**
32+
>
33+
> If you haven’t already, you’ll need to [install
34+
> Quarto](https://quarto.org/docs/get-started/) before you can use
35+
> quartodoc.
36+
37+
</div>
38+
39+
## Basic use
40+
41+
Getting started with quartodoc takes two steps: configuring quartodoc,
42+
then generating documentation pages for your library.
43+
44+
You can configure quartodoc alongside the rest of your Quarto site in
45+
the
46+
[`_quarto.yml`](https://quarto.org/docs/projects/quarto-projects.html)
47+
file you are already using for Quarto. To [configure
48+
quartodoc](basic-docs.qmd#site-configuration), you need to add a
49+
`quartodoc` section to the top level your `_quarto.yml` file. Below is a
50+
minimal example of a configuration that documents the `quartodoc`
51+
package:
52+
53+
``` yaml
54+
project:
55+
type: website
56+
57+
# tell quarto to read the generated sidebar
58+
metadata-files:
59+
- _sidebar.yml
60+
61+
62+
quartodoc:
63+
# the name used to import the package you want to create reference docs for
64+
package: quartodoc
65+
66+
# write sidebar data to this file
67+
sidebar: _sidebar.yml
68+
69+
sections:
70+
- title: Some functions
71+
desc: Functions to inspect docstrings.
72+
contents:
73+
# the functions being documented in the package.
74+
# you can refer to anything: class methods, modules, etc..
75+
- get_object
76+
- preview
77+
```
78+
79+
Now that you have configured quartodoc, you can generate the reference
80+
API docs with the following command:
81+
82+
``` bash
83+
quartodoc build
84+
```
85+
86+
This will create a `reference/` directory with an `index.qmd` and
87+
documentation pages for listed functions, like `get_object` and
88+
`preview`.
89+
90+
Finally, preview your website with quarto:
91+
92+
``` bash
93+
quarto preview
94+
```
95+
96+
## Rebuilding site
97+
98+
You can preview your `quartodoc` site using the following commands:
99+
100+
First, watch for changes to the library you are documenting so that your
101+
docs will automatically re-generate:
102+
103+
``` bash
104+
quartodoc build --watch
105+
```
106+
107+
Second, preview your site:
108+
109+
``` bash
110+
quarto preview
111+
```
112+
113+
## Looking up objects
114+
115+
Generating API reference docs for Python objects involves two pieces of
116+
configuration:
117+
118+
1. the package name.
119+
2. a list of objects for content.
120+
121+
quartodoc can look up a wide variety of objects, including functions,
122+
modules, classes, attributes, and methods:
123+
124+
``` yaml
125+
quartodoc:
126+
package: quartodoc
127+
sections:
128+
- title: Some section
129+
desc: ""
130+
contents:
131+
- get_object # function: quartodoc.get_object
132+
- ast.preview # submodule func: quartodoc.ast.preview
133+
- MdRenderer # class: quartodoc.MdRenderer
134+
- MdRenderer.render # method: quartodoc.MDRenderer.render
135+
- renderers # module: quartodoc.renderers
136+
```
137+
138+
The functions listed in `contents` are assumed to be imported from the
139+
package.
140+
141+
## Learning more
142+
143+
Go [to the next page](basic-docs.qmd) to learn how to configure
144+
quartodoc sites, or check out these handy pages:
145+
146+
- [Examples page](../examples/index.qmd): sites using quartodoc.
147+
- [Tutorials page](../tutorials/index.qmd): screencasts of building a
148+
quartodoc site.
149+
- [Docstring issues and examples](docstring-examples.qmd): common issues
150+
when formatting docstrings.
151+
- [Programming, the big picture](dev-big-picture.qmd): the nitty gritty
152+
of how quartodoc works, and how to extend it.

0 commit comments

Comments
 (0)