Skip to content

Commit f3fa2db

Browse files
authored
docs: rewrite README and contributing guide for public readers (#9)
1 parent 16e3cba commit f3fa2db

3 files changed

Lines changed: 184 additions & 121 deletions

File tree

‎CONTRIBUTING.md‎

Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
# Contributing to the DFO docs
22

3-
The DFO docs serve analysts who know the DAC and the CRS, write some Python or R, and need data they can trust in their own work. AI assistants read the same pages. This guide covers where pages live, how to write one, and how a source repository publishes its own pages into the corpus.
3+
Issues and pull requests are welcome. The ONE Data team maintains this repository. Open an issue to discuss a large change, such as a new section or a new source repository, before you write it. Contributors follow the [Code of Conduct](https://github.com/DevelopmentFinanceObservatory/.github/blob/main/CODE_OF_CONDUCT.md). Report security issues through the "Report a vulnerability" button under the repository's Security tab, as the [security policy](https://github.com/DevelopmentFinanceObservatory/.github/blob/main/SECURITY.md) describes.
4+
5+
The DFO docs serve analysts who know the DAC and the CRS, write some Python or R, and need data they can trust in their own work. AI assistants read the same pages.
46

57
## Where pages live
68

79
The site publishes hub pages from Markdown files under `content/hub/` in this repository. Source pages live in each source repository's docs folder, and the build fetches them through a row in `sources.yaml`.
810

9-
```
11+
```text
1012
dfo-docs/
1113
├── content/hub/ hub pages; a page's URL is its path here
1214
│ ├── index.md Home, published at /docs
@@ -21,7 +23,7 @@ dfo-docs/
2123

2224
A hub page publishes at its path under `content/hub/` without the `.md` suffix, so `content/hub/data/glossary.md` publishes at `/docs/data/glossary`. Its place in the nav comes from `hub.yaml`, so a page can move in the nav without changing its URL. Only pages named in `hub.yaml` publish.
2325

24-
A source repository with several pages groups them by mode: `tutorials/`, `how-to/` and `about/`, as `tossd-reader` does.
26+
A source repository with several pages groups them by mode in `tutorials/`, `how-to/` and `about/`, as `tossd-reader` does.
2527

2628
## Writing a page
2729

@@ -48,11 +50,11 @@ Use DFO values in examples, including `country/NGA`, CRS purpose 12220, finance
4850

4951
End every page with a `## Next` section of one or two links, each with a sentence saying what the reader gets there. Leave out boilerplate headings such as Overview, Summary or Conclusion.
5052

51-
Use only three callouts: `!!! note`, `!!! tip` and `!!! warning`. Leave them untitled and indent the body four spaces. The build renders them as site alerts. A title becomes a bold lead sentence, so put the point in the body. Use callouts for optional material and keep required information in the page body.
53+
Use only three callouts, `!!! note`, `!!! tip` and `!!! warning`. Leave them untitled and indent the body four spaces. The build renders them as site alerts. A title becomes a bold lead sentence, so put the point in the body. Use callouts for optional material and keep required information in the page body.
5254

5355
```markdown
5456
!!! warning
55-
Studio links are always snapshots.
57+
Studio links are always snapshots.
5658
```
5759

5860
The build passes collapsible `???` blocks through unchanged, where they render as raw text. Leave them out.
@@ -96,7 +98,7 @@ Only published pages are valid link targets. The link check fails for a page abs
9698

9799
## Publishing a source repository's docs
98100

99-
A source repository keeps its pages in a docs folder and declares them in a nav sidecar. The build looks for the sidecar in three places, in this order: `docs/mkdocs.yml`, a root `mkdocs.yml`, and a root `zensical.toml`. The docs root is the sidecar's own `docs_dir`, resolved from the folder the sidecar sits in.
101+
A source repository keeps its pages in a docs folder and declares them in a nav sidecar. The build looks for the sidecar at `docs/mkdocs.yml`, then a root `mkdocs.yml`, then a root `zensical.toml`. The docs root is the sidecar's own `docs_dir`, resolved from the folder the sidecar sits in.
100102

101103
Use a root `mkdocs.yml` when user-facing pages sit in a subfolder separate from a repository's internal docs. `apis` publishes `docs/guide/` this way:
102104

@@ -119,30 +121,40 @@ nav:
119121
Then register the repository in `sources.yaml`:
120122

121123
```yaml
122-
- name: dfo-apis
123-
repo: DevelopmentFinanceObservatory/apis
124-
ref: dev
125-
docs_dir: docs/guide
126-
path: api
127-
title: API
124+
- name: dfo-apis
125+
repo: DevelopmentFinanceObservatory/apis
126+
ref: dev
127+
docs_dir: docs/guide
128+
path: api
129+
title: API
128130
```
129131

130-
In `sources.yaml`, `docs_dir` sets which folder the build checks out. Match it to the sidecar's `docs_dir`. Set `path` to `extra.dfo.path`. The build fails if they differ. Add a `mount` entry in `hub.yaml` that names the source row. To register a repository before publication, set `enabled: false` with a `reason` and leave it out of `hub.yaml`. A mount for a disabled source fails the build. Every registered repository must be public. The README covers `exclude`, `kind: external`, `kind: skill`, and each build failure.
132+
In `sources.yaml`, `docs_dir` sets which folder the build checks out. Match it to the sidecar's `docs_dir`. Set `path` to `extra.dfo.path`. The build fails if they differ. Add a `mount` entry in `hub.yaml` that names the source row. To register a repository before publication, set `enabled: false` with a `reason` and leave it out of `hub.yaml`. A mount for a disabled source fails the build. Every registered repository must be public. [docs/development.md](docs/development.md) covers `exclude`, `kind: external`, `kind: skill`, and each build failure.
131133

132134
Before opening a pull request in the source repository, check its nav against its pages from a `docs` checkout. Then check links from the source repository's docs folder:
133135

134-
```
136+
```bash
135137
uv run python scripts/check_nav.py /path/to/source-repo
136138
lychee --offline /path/to/source-repo/docs/guide/
137139
```
138140

139141
## Checking a change here
140142

141-
```
143+
```bash
142144
uv run ruff check .
145+
uv run ruff format --check .
146+
uv run ty check src/dfo_docs
143147
uv run pytest
144148
uv run python scripts/build.py --out /tmp/dfo-docs-build
145149
lychee --config lychee.toml /tmp/dfo-docs-build/corpus/
146150
```
147151

148-
The build clones every enabled source over HTTPS without credentials.
152+
The build clones every enabled source over HTTPS without credentials, so none of this needs ONE's cloud access. Run `uv run pre-commit install` once, and pre-commit then runs the formatters and hygiene checks on each commit.
153+
154+
## Pull requests
155+
156+
Branch from `dev` and open the pull request into `dev`. A push to `dev` rebuilds the corpus the site reads, and a pull request runs the build without publishing. A draft pull request runs no CI, so mark it ready when you want the checks. CI runs ruff, ty, the tests on Python 3.13 and 3.14, the build, and the link check. A page change needs a description in its front matter and working links. Code changes need tests and must pass these checks.
157+
158+
Commit messages follow Conventional Commits, such as `docs(docsync): describe the first run without state`.
159+
160+
Maintainer internals are in [docs/development.md](docs/development.md).

0 commit comments

Comments
 (0)