Skip to content

Commit 31ced9d

Browse files
authored
🔧 Migrate docs from MkDocs to Zensical (fastapi#15563)
1 parent 6f9dcdf commit 31ced9d

35 files changed

Lines changed: 339 additions & 459 deletions

.github/workflows/build-docs.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,13 @@ jobs:
3434
- docs_src/**
3535
- pyproject.toml
3636
- uv.lock
37-
- mkdocs.yml
38-
- mkdocs.env.yml
3937
- .github/workflows/build-docs.yml
4038
- .github/workflows/deploy-docs.yml
41-
- scripts/mkdocs_hooks.py
39+
- scripts/docs.py
4240
langs:
4341
needs:
4442
- changes
43+
if: ${{ needs.changes.outputs.docs == 'true' }}
4544
runs-on: ubuntu-latest
4645
outputs:
4746
langs: ${{ steps.show-langs.outputs.langs }}
@@ -103,26 +102,33 @@ jobs:
103102
run: uv run ./scripts/docs.py update-languages
104103
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
105104
with:
106-
key: mkdocs-cards-${{ matrix.lang }}-${{ github.ref }}
107-
path: docs/${{ matrix.lang }}/.cache
105+
key: zensical-${{ matrix.lang }}-${{ github.ref }}
106+
path: site_zensical_src/${{ matrix.lang }}/.cache
108107
- name: Build Docs
109108
run: | # zizmor: ignore[template-injection] - comes from trusted source
110109
uv run ./scripts/docs.py build-lang ${{ matrix.lang }}
111110
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
112111
with:
113112
name: docs-site-${{ matrix.lang }}
114-
path: ./site/**
113+
# English owns root static assets. Translated pages reference /img, /css,
114+
# and /js, so omit duplicated language-local copies from artifacts.
115+
path: |
116+
./site/**
117+
!./site/${{ matrix.lang }}/img/**
118+
!./site/${{ matrix.lang }}/css/**
119+
!./site/${{ matrix.lang }}/js/**
115120
include-hidden-files: true
116121

117122
# https://github.com/marketplace/actions/alls-green#why
118123
docs-all-green: # This job does nothing and is only used for the branch protection
119124
if: always()
120125
needs:
126+
- langs
121127
- build-docs
122128
runs-on: ubuntu-latest
123129
steps:
124130
- name: Decide whether the needed jobs succeeded or failed
125131
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # v1.2.2
126132
with:
127133
jobs: ${{ toJSON(needs) }}
128-
allowed-skips: build-docs
134+
allowed-skips: langs, build-docs

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ __pycache__
77
htmlcov
88
dist
99
site
10+
site_zensical_src
1011
.coverage*
1112
coverage.xml
1213
.netlify

docs/de/docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
include_yaml:
3+
sponsors: data/sponsors.yml
4+
---
5+
16
# FastAPI { #fastapi }
27

38
<style>

docs/de/mkdocs.yml

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

docs/en/docs/contributing.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,10 @@ Go into the language directory, for the main docs in English it's at `docs/en/`:
100100
$ cd docs/en/
101101
```
102102

103-
Then run `mkdocs` in that directory:
103+
Then run `zensical` in that directory:
104104

105105
```console
106-
$ mkdocs serve --dev-addr 127.0.0.1:8008
106+
$ zensical serve --dev-addr 127.0.0.1:8008
107107
```
108108

109109
///
@@ -129,7 +129,7 @@ Completion will take effect once you restart the terminal.
129129

130130
### Docs Structure
131131

132-
The documentation uses [MkDocs](https://www.mkdocs.org/).
132+
The documentation uses [Zensical](https://zensical.org).
133133

134134
And there are extra tools/scripts in place to handle translations in `./scripts/docs.py`.
135135

docs/en/docs/external-links.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
include_yaml:
3+
topic_repos: data/topic_repos.yml
4+
---
5+
16
# External Links
27

38
**FastAPI** has a great community constantly growing.

docs/en/docs/fastapi-people.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
---
22
hide:
33
- navigation
4+
5+
include_yaml:
6+
github_sponsors: data/github_sponsors.yml
7+
people: data/people.yml
8+
contributors: data/contributors.yml
9+
translation_reviewers: data/translation_reviewers.yml
10+
skip_users: data/skip_users.yml
11+
members: data/members.yml
12+
sponsors_badge: data/sponsors_badge.yml
13+
sponsors: data/sponsors.yml
414
---
515

616
# FastAPI People

docs/en/docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
include_yaml:
3+
sponsors: data/sponsors.yml
4+
---
5+
16
# FastAPI { #fastapi }
27

38
<style>

docs/en/mkdocs.env.yml

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

docs/en/mkdocs.yml

Lines changed: 22 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
INHERIT: ../en/mkdocs.env.yml
21
site_name: FastAPI
32
site_description: FastAPI framework, high performance, easy to learn, fast to code, ready for production
43
site_url: https://fastapi.tiangolo.com/
54
theme:
5+
variant: classic
66
name: material
7-
custom_dir: ../en/overrides
7+
custom_dir: overrides
88
palette:
99
- media: (prefers-color-scheme)
1010
toggle:
@@ -45,38 +45,13 @@ theme:
4545
- search.suggest
4646
- toc.follow
4747
icon:
48-
repo: fontawesome/brands/github-alt
48+
repo: octicons/mark-github-24
4949
logo: img/icon-white.svg
5050
favicon: img/favicon.png
5151
language: en
5252
repo_name: fastapi/fastapi
5353
repo_url: https://github.com/fastapi/fastapi
5454
plugins:
55-
social:
56-
cards_layout_options:
57-
logo: ../en/docs/img/icon-white.svg
58-
typeset: null
59-
search: null
60-
macros:
61-
include_yaml:
62-
- github_sponsors: ../en/data/github_sponsors.yml
63-
- people: ../en/data/people.yml
64-
- contributors: ../en/data/contributors.yml
65-
- translators: ../en/data/translators.yml
66-
- translation_reviewers: ../en/data/translation_reviewers.yml
67-
- skip_users: ../en/data/skip_users.yml
68-
- members: ../en/data/members.yml
69-
- sponsors_badge: ../en/data/sponsors_badge.yml
70-
- sponsors: ../en/data/sponsors.yml
71-
- topic_repos: ../en/data/topic_repos.yml
72-
redirects:
73-
redirect_maps:
74-
deployment/deta.md: deployment/cloud.md
75-
advanced/graphql.md: how-to/graphql.md
76-
advanced/custom-request-and-route.md: how-to/custom-request-and-route.md
77-
advanced/conditional-openapi.md: how-to/conditional-openapi.md
78-
advanced/extending-openapi.md: how-to/extending-openapi.md
79-
advanced/testing-database.md: how-to/testing-database.md
8055
mkdocstrings:
8156
handlers:
8257
python:
@@ -102,13 +77,13 @@ plugins:
10277
nav:
10378
- FastAPI: index.md
10479
- features.md
105-
- Learn:
80+
- "":
10681
- learn/index.md
10782
- python-types.md
10883
- async.md
10984
- environment-variables.md
11085
- virtual-environments.md
111-
- Tutorial - User Guide:
86+
- "":
11287
- tutorial/index.md
11388
- tutorial/first-steps.md
11489
- tutorial/path-params.md
@@ -137,14 +112,14 @@ nav:
137112
- tutorial/path-operation-configuration.md
138113
- tutorial/encoder.md
139114
- tutorial/body-updates.md
140-
- Dependencies:
115+
- "":
141116
- tutorial/dependencies/index.md
142117
- tutorial/dependencies/classes-as-dependencies.md
143118
- tutorial/dependencies/sub-dependencies.md
144119
- tutorial/dependencies/dependencies-in-path-operation-decorators.md
145120
- tutorial/dependencies/global-dependencies.md
146121
- tutorial/dependencies/dependencies-with-yield.md
147-
- Security:
122+
- "":
148123
- tutorial/security/index.md
149124
- tutorial/security/first-steps.md
150125
- tutorial/security/get-current-user.md
@@ -161,7 +136,7 @@ nav:
161136
- tutorial/static-files.md
162137
- tutorial/testing.md
163138
- tutorial/debugging.md
164-
- Advanced User Guide:
139+
- "":
165140
- advanced/index.md
166141
- advanced/stream-data.md
167142
- advanced/path-operation-advanced-configuration.md
@@ -173,7 +148,7 @@ nav:
173148
- advanced/response-headers.md
174149
- advanced/response-change-status-code.md
175150
- advanced/advanced-dependencies.md
176-
- Advanced Security:
151+
- "":
177152
- advanced/security/index.md
178153
- advanced/security/oauth2-scopes.md
179154
- advanced/security/http-basic-auth.md
@@ -199,7 +174,7 @@ nav:
199174
- advanced/strict-content-type.md
200175
- fastapi-cli.md
201176
- editor-support.md
202-
- Deployment:
177+
- "":
203178
- deployment/index.md
204179
- deployment/versions.md
205180
- deployment/fastapicloud.md
@@ -209,7 +184,7 @@ nav:
209184
- deployment/cloud.md
210185
- deployment/server-workers.md
211186
- deployment/docker.md
212-
- How To - Recipes:
187+
- "":
213188
- how-to/index.md
214189
- how-to/general.md
215190
- how-to/migrate-from-pydantic-v1-to-pydantic-v2.md
@@ -222,7 +197,7 @@ nav:
222197
- how-to/configure-swagger-ui.md
223198
- how-to/testing-database.md
224199
- how-to/authentication-error-status-code.md
225-
- Reference (Code API):
200+
- "":
226201
- reference/index.md
227202
- reference/fastapi.md
228203
- reference/parameters.md
@@ -238,7 +213,7 @@ nav:
238213
- reference/response.md
239214
- reference/responses.md
240215
- reference/middleware.md
241-
- OpenAPI:
216+
- "":
242217
- reference/openapi/index.md
243218
- reference/openapi/docs.md
244219
- reference/openapi/models.md
@@ -248,26 +223,23 @@ nav:
248223
- reference/templating.md
249224
- reference/testclient.md
250225
- fastapi-people.md
251-
- Resources:
226+
- "":
252227
- resources/index.md
253228
- help-fastapi.md
254229
- contributing.md
255230
- project-generation.md
256231
- external-links.md
257232
- newsletter.md
258233
- management-tasks.md
259-
- About:
234+
- "":
260235
- about/index.md
261236
- alternatives.md
262237
- history-design-future.md
263238
- benchmarks.md
264239
- management.md
265240
- release-notes.md
266241
markdown_extensions:
267-
material.extensions.preview:
268-
targets:
269-
include:
270-
- '*'
242+
zensical.extensions.macros: null
271243
abbr: null
272244
attr_list: null
273245
footnotes: null
@@ -312,16 +284,16 @@ markdown_extensions:
312284
markdown_include_variants: null
313285
extra:
314286
social:
315-
- icon: fontawesome/brands/github-alt
287+
- icon: octicons/mark-github-24
316288
link: https://github.com/fastapi/fastapi
317289
- icon: fontawesome/brands/discord
318290
link: https://discord.gg/VQjSZaeJmf
319-
- icon: fontawesome/brands/twitter
291+
- icon: fontawesome/brands/x-twitter
320292
link: https://x.com/fastapi
293+
- icon: fontawesome/brands/bluesky
294+
link: https://bsky.app/profile/fastapi.tiangolo.com
321295
- icon: fontawesome/brands/linkedin
322296
link: https://www.linkedin.com/company/fastapi
323-
- icon: fontawesome/solid/globe
324-
link: https://tiangolo.com
325297
alternate:
326298
- link: /
327299
name: en - English
@@ -354,5 +326,5 @@ extra_javascript:
354326
- js/termynal.js
355327
- js/custom.js
356328
- js/init_kapa_widget.js
357-
hooks:
358-
- ../../scripts/mkdocs_hooks.py
329+
validation:
330+
unresolved_references: false

0 commit comments

Comments
 (0)