Skip to content

Commit f882734

Browse files
committed
docs(redesign): restructure to Library Skeleton (#451)
Restructure django-docutils documentation to the Library Skeleton. topics/ section created (template_tag, template_filter, class_based_view, faq moved from root). API index cards. project/ section. Standalone composed homepage. 4 redirects. sphinx-design added.
2 parents 4b902fa + f475a1e commit f882734

15 files changed

Lines changed: 325 additions & 17 deletions

docs/api/index.md

Lines changed: 35 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,48 @@
88

99
:::
1010

11-
## Inside
11+
::::{grid} 1 1 2 2
12+
:gutter: 2 2 3 3
13+
14+
:::{grid-item-card} Exceptions
15+
:link: exc
16+
:link-type: doc
17+
Exception definitions for django-docutils.
18+
:::
19+
20+
:::{grid-item-card} Views
21+
:link: views
22+
:link-type: doc
23+
`DocutilsView` and response classes.
24+
:::
25+
26+
:::{grid-item-card} Lib
27+
:link: lib/index
28+
:link-type: doc
29+
Publisher, roles, directives, writers, and transforms.
30+
:::
31+
32+
:::{grid-item-card} Template Engine
33+
:link: template
34+
:link-type: doc
35+
`DocutilsTemplates` backend for Django.
36+
:::
37+
38+
:::{grid-item-card} Template Tags
39+
:link: templatetags/index
40+
:link-type: doc
41+
`{% rst %}` tag and `rst` filter internals.
42+
:::
43+
44+
::::
1245

1346
```{toctree}
1447
:maxdepth: 1
48+
:hidden:
1549
1650
exc
1751
views
1852
lib/index
1953
template
2054
templatetags/index
2155
```
22-
23-
## Common
24-
25-
### Exceptions
26-
27-
See {doc}`/api/exc` for exception definitions.

docs/conf.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@
4747
"sphinxext.opengraph",
4848
"sphinxext.rediraffe",
4949
"myst_parser",
50+
"sphinx_design",
5051
"linkify_issues",
5152
]
53+
myst_heading_anchors = 4
5254
myst_enable_extensions = [
5355
"colon_fence",
5456
"substitution",

docs/index.md

Lines changed: 55 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,70 @@
11
(index)=
22

3-
```{include} ../README.md
3+
# django-docutils
44

5+
Docutils (reStructuredText) support for Django templates, views, and template engines.
6+
7+
::::{grid} 1 1 2 2
8+
:gutter: 2 2 3 3
9+
10+
:::{grid-item-card} Quickstart
11+
:link: quickstart
12+
:link-type: doc
13+
Install and render your first RST snippet in 5 minutes.
14+
:::
15+
16+
:::{grid-item-card} Topics
17+
:link: topics/index
18+
:link-type: doc
19+
Template tags, template filters, class-based views, and FAQ.
20+
:::
21+
22+
:::{grid-item-card} API Reference
23+
:link: api/index
24+
:link-type: doc
25+
Every public class, function, and exception.
26+
:::
27+
28+
:::{grid-item-card} Contributing
29+
:link: project/index
30+
:link-type: doc
31+
Development setup, code style, release process.
32+
:::
33+
34+
::::
35+
36+
## Install
37+
38+
```console
39+
$ pip install django-docutils
540
```
641

7-
```{toctree}
8-
:maxdepth: 2
9-
:hidden:
42+
```console
43+
$ uv add django-docutils
44+
```
1045

11-
quickstart
12-
template_tag
13-
template_filter
14-
class_based_view
15-
faq
46+
See [Quickstart](quickstart.md) for configuration and first steps.
47+
48+
## At a glance
49+
50+
```django
51+
{% load django_docutils %}
52+
53+
{% rst %}
54+
Title
55+
=====
56+
57+
*reStructuredText* rendered to HTML inside a Django template.
58+
{% endrst %}
1659
```
1760

1861
```{toctree}
19-
:caption: Project
2062
:hidden:
2163
64+
quickstart
65+
topics/index
2266
api/index
67+
project/index
2368
history
2469
GitHub <https://github.com/tony/django-docutils>
2570
```

docs/project/code-style.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Code Style
2+
3+
## Formatting
4+
5+
django-docutils uses [ruff](https://github.com/astral-sh/ruff) for both linting and formatting.
6+
7+
```console
8+
$ uv run ruff format .
9+
```
10+
11+
```console
12+
$ uv run ruff check . --fix --show-fixes
13+
```
14+
15+
## Type Checking
16+
17+
Strict [mypy](https://mypy-lang.org/) with [django-stubs](https://github.com/typeddjango/django-stubs) is enforced across `src/` and `tests/`.
18+
19+
```console
20+
$ uv run mypy
21+
```
22+
23+
## Docstrings
24+
25+
Follow [NumPy-style docstrings](https://numpydoc.readthedocs.io/en/latest/format.html) for all public functions and methods.
26+
27+
## Imports
28+
29+
- Always include `from __future__ import annotations` at the top of Python files.
30+
- Use `import typing as t` and access via namespace: `t.Optional`, `t.Dict`, etc.

docs/project/contributing.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# Development
2+
3+
Install [git](https://git-scm.com/) and [uv](https://github.com/astral-sh/uv).
4+
5+
Clone:
6+
7+
```console
8+
$ git clone https://github.com/tony/django-docutils.git
9+
```
10+
11+
```console
12+
$ cd django-docutils
13+
```
14+
15+
Install packages:
16+
17+
```console
18+
$ uv sync --all-extras --dev
19+
```
20+
21+
## Running Tests
22+
23+
```console
24+
$ uv run pytest
25+
```
26+
27+
Run a single test file:
28+
29+
```console
30+
$ uv run pytest tests/test_template.py
31+
```
32+
33+
Watch tests:
34+
35+
```console
36+
$ uv run ptw .
37+
```
38+
39+
## Building Docs
40+
41+
```console
42+
$ uv run sphinx-build docs docs/_build
43+
```
44+
45+
Live-reload:
46+
47+
```console
48+
$ uv run sphinx-autobuild docs docs/_build
49+
```

docs/project/index.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
(project)=
2+
3+
# Project
4+
5+
Information for contributors and maintainers.
6+
7+
::::{grid} 1 1 2 2
8+
:gutter: 2 2 3 3
9+
10+
:::{grid-item-card} Contributing
11+
:link: contributing
12+
:link-type: doc
13+
Development setup, running tests, submitting PRs.
14+
:::
15+
16+
:::{grid-item-card} Code Style
17+
:link: code-style
18+
:link-type: doc
19+
Ruff, mypy, NumPy docstrings, import conventions.
20+
:::
21+
22+
:::{grid-item-card} Releasing
23+
:link: releasing
24+
:link-type: doc
25+
Release checklist and version policy.
26+
:::
27+
28+
::::
29+
30+
```{toctree}
31+
:hidden:
32+
33+
contributing
34+
code-style
35+
releasing
36+
```

docs/project/releasing.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Releasing
2+
3+
## Version Policy
4+
5+
django-docutils is pre-1.0. Minor version bumps may include breaking changes.
6+
Users should pin to `>=0.x,<0.y`.
7+
8+
## Release Process
9+
10+
Releases are triggered by git tags and published to PyPI via trusted publishing.
11+
12+
1. Update `CHANGES` with the release notes
13+
14+
2. Bump version in `src/django_docutils/__about__.py`
15+
16+
3. Commit:
17+
18+
```console
19+
$ git commit -m "django-docutils <version>"
20+
```
21+
22+
4. Tag:
23+
24+
```console
25+
$ git tag v<version>
26+
```
27+
28+
5. Push:
29+
30+
```console
31+
$ git push && git push --tags
32+
```

docs/redirects.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
"usage.rst" "quickstart.md"
22
# "api.md" "api/index.md" # dirhtml: same output path
33
"django_view.rst" "class_based_view.md"
4+
"template_tag.md" "topics/template_tag.md"
5+
"template_filter.md" "topics/template_filter.md"
6+
"class_based_view.md" "topics/class_based_view.md"
7+
"faq.md" "topics/faq.md"
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)