]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🔨 Add MkDocs hook that renames sections based on the first index file (#9737)
authorSebastián Ramírez <tiangolo@gmail.com>
Sat, 24 Jun 2023 14:47:15 +0000 (16:47 +0200)
committerGitHub <noreply@github.com>
Sat, 24 Jun 2023 14:47:15 +0000 (16:47 +0200)
58 files changed:
docs/az/mkdocs.yml
docs/cs/mkdocs.yml
docs/de/mkdocs.yml
docs/em/docs/advanced/index.md
docs/em/docs/advanced/security/index.md
docs/em/docs/deployment/index.md
docs/em/docs/tutorial/dependencies/index.md
docs/em/docs/tutorial/index.md
docs/em/docs/tutorial/security/index.md
docs/em/mkdocs.yml
docs/en/docs/advanced/index.md
docs/en/docs/advanced/security/index.md
docs/en/docs/deployment/index.md
docs/en/docs/tutorial/dependencies/index.md
docs/en/docs/tutorial/index.md
docs/en/docs/tutorial/security/index.md
docs/en/mkdocs.yml
docs/es/docs/advanced/index.md
docs/es/docs/tutorial/index.md
docs/es/mkdocs.yml
docs/fa/mkdocs.yml
docs/fr/docs/advanced/index.md
docs/fr/docs/deployment/index.md
docs/fr/mkdocs.yml
docs/he/mkdocs.yml
docs/hy/mkdocs.yml
docs/id/mkdocs.yml
docs/it/mkdocs.yml
docs/ja/docs/advanced/index.md
docs/ja/docs/deployment/index.md
docs/ja/docs/tutorial/index.md
docs/ja/mkdocs.yml
docs/ko/docs/tutorial/index.md
docs/ko/mkdocs.yml
docs/lo/mkdocs.yml
docs/nl/mkdocs.yml
docs/pl/docs/tutorial/index.md
docs/pl/mkdocs.yml
docs/pt/docs/advanced/index.md
docs/pt/docs/deployment/index.md
docs/pt/docs/tutorial/index.md
docs/pt/docs/tutorial/security/index.md
docs/pt/mkdocs.yml
docs/ru/docs/deployment/index.md
docs/ru/docs/tutorial/index.md
docs/ru/mkdocs.yml
docs/sq/mkdocs.yml
docs/sv/mkdocs.yml
docs/ta/mkdocs.yml
docs/tr/mkdocs.yml
docs/uk/mkdocs.yml
docs/zh/docs/advanced/index.md
docs/zh/docs/advanced/security/index.md
docs/zh/docs/tutorial/dependencies/index.md
docs/zh/docs/tutorial/index.md
docs/zh/docs/tutorial/security/index.md
docs/zh/mkdocs.yml
scripts/mkdocs_hooks.py [new file with mode: 0644]

index b846b91f820b5cef199a7a9498a4ba698d5ab5fe..c9f467768bfca08c3e8dc325900180dfeb81eced 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index c303d8f6af8a80936a33872fff901e7ba3e5c337..358f0ccf298cb2f5e0b019cbe5b320ec5a382c54 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 4be9825098c3dccd73ebb9ef6f7da821a452a96f..bdbaa36e3d71a9e96512abdee8d067459778c2f7 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -159,3 +160,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 6a43a09e7c3d482f1c69c4e472624bc124dcc90c..abe8d357c90ac8a4d3e8d593272bb70e23870972 100644 (file)
@@ -1,4 +1,4 @@
-# 🏧 👩‍💻 🦮 - 🎶
+# 🏧 👩‍💻 🦮
 
 ## 🌖 ⚒
 
index 20ee85553d1b9d02d655ee73198847da46e40a0b..f2bb66df465c2702af7f4aa6ccc99ef023fb15c3 100644 (file)
@@ -1,4 +1,4 @@
-# 🏧 💂‍♂ - 🎶
+# 🏧 💂‍♂
 
 ## 🌖 ⚒
 
index 1010c589f3393796ad8d28ad97e73fdce315a2ea..9bcf427b6994f4407ee6f2206daaa6be1ff4b138 100644 (file)
@@ -1,4 +1,4 @@
-# 🛠️ - 🎶
+# 🛠️
 
 🛠️ **FastAPI** 🈸 📶 ⏩.
 
index f1c28c5733dd8115c289790cefab402b18107074..ffd38d71684f3edde3651b0f269cbef9e03507d2 100644 (file)
@@ -1,4 +1,4 @@
-# 🔗 - 🥇 🔁
+# 🔗
 
 **FastAPI** ✔️ 📶 🏋️ ✋️ 🏋️ **<abbr title="also known as components, resources, providers, services, injectables">🔗 💉</abbr>** ⚙️.
 
index 8536dc3eeb595de9b4343d5806224fd5cbcf07be..26b4c1913a5e3efaeeff7263b2258557aa07e25b 100644 (file)
@@ -1,4 +1,4 @@
-# 🔰 - 👩‍💻 🦮 - 🎶
+# 🔰 - 👩‍💻 🦮
 
 👉 🔰 🎦 👆 ❔ ⚙️ **FastAPI** ⏮️ 🌅 🚮 ⚒, 🔁 🔁.
 
index 5b507af3e042d6fac06e7ac2e8f9cb7c107b5115..d76f7203fe96bf1bcc3f9cae8bdbf8100a627e1f 100644 (file)
@@ -1,4 +1,4 @@
-# 💂‍♂ 🎶
+# 💂‍♂
 
 📤 📚 🌌 🍵 💂‍♂, 🤝 &amp; ✔.
 
index bceef0d65ae979e91d44550e76aa6d2ad7d64f35..8b6b3997ce368049ff80960295eb53854c5dedf1 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -265,3 +266,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 917f4a62eb562ec4cdf6dd108d0101abcb50dc2a..467f0833e60a6410e126587be06f7d41baba40ee 100644 (file)
@@ -1,4 +1,4 @@
-# Advanced User Guide - Intro
+# Advanced User Guide
 
 ## Additional Features
 
index 0c94986b5728ebfe8278787df8bde6eef92e218e..c18baf64b0d276211a78ca0e39b8123785dbb224 100644 (file)
@@ -1,4 +1,4 @@
-# Advanced Security - Intro
+# Advanced Security
 
 ## Additional Features
 
index f0fd001cd511ae66c1f76ff0ccb4c1ada52a2a65..6c43d8abbe4dbc925a07fac0b27ac7247c7cd9d3 100644 (file)
@@ -1,4 +1,4 @@
-# Deployment - Intro
+# Deployment
 
 Deploying a **FastAPI** application is relatively easy.
 
index 4f5ecea6668033663ef8f9557089e55ab43dd5ca..f6f4bced08a76dfb7584eab33896e48070b9cb07 100644 (file)
@@ -1,4 +1,4 @@
-# Dependencies - First Steps
+# Dependencies
 
 **FastAPI** has a very powerful but intuitive **<abbr title="also known as components, resources, providers, services, injectables">Dependency Injection</abbr>** system.
 
index 8b4a9df9be8cc9597016c0eefae30e73fbea3df7..75665324d91cb16d8e7fc6ad6cde3bf2a640c564 100644 (file)
@@ -1,4 +1,4 @@
-# Tutorial - User Guide - Intro
+# Tutorial - User Guide
 
 This tutorial shows you how to use **FastAPI** with most of its features, step by step.
 
index 035b317363cd8bd18aa94b14b320dd9c1e3203f7..659a94dc30179ba004aa0bff0038fe552bbfa63e 100644 (file)
@@ -1,4 +1,4 @@
-# Security Intro
+# Security
 
 There are many ways to handle security, authentication and authorization.
 
index 73df174d1923e1e6be6ede1eedc4f5912b0b65cf..40dfb1661c717187b7c072635c5476fdadeeb915 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: img/icon-white.svg
@@ -265,3 +266,5 @@ extra_css:
 extra_javascript:
 - js/termynal.js
 - js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 1bee540f2bdc7ba781d41be430a848bc0d2bfea5..ba1d20b0d1758c48b060c8446bb573fbe99305f5 100644 (file)
@@ -1,4 +1,4 @@
-# Guía de Usuario Avanzada - Introducción
+# Guía de Usuario Avanzada
 
 ## Características Adicionales
 
index e3671f381ef093b766d99d6652a1dc346a910a39..1cff8b4e3e1503c96495802ec19b917b12dab6af 100644 (file)
@@ -1,4 +1,4 @@
-# Tutorial - Guía de Usuario - Introducción
+# Tutorial - Guía de Usuario
 
 Este tutorial te muestra cómo usar **FastAPI** con la mayoría de sus características paso a paso.
 
index e01f55b3abbe361fe1394688ca31bf9bbd4e5ec5..d8aa9c494dd090e4fc0d0957b69ffc0aa2f77d0b 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -168,3 +169,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 5c5b5e3e170b10216c1decfa1e283eca38de0fa7..287521ab3651a442fcf7e99764a774a0b0245989 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 41737889a0d2afe97e94ce864d94e250c063938b..f4fa5ecf6962436b4640a9c6e05f0214ab24171c 100644 (file)
@@ -1,4 +1,4 @@
-# Guide de l'utilisateur avancé - Introduction
+# Guide de l'utilisateur avancé
 
 ## Caractéristiques supplémentaires
 
index e855adfa3c1ed1ad23c12ff96204c771c6fbdf08..e2014afe9561cc2f4f3813e61f96e0bf7890393f 100644 (file)
@@ -1,4 +1,4 @@
-# Déploiement - Intro
+# Déploiement
 
 Le déploiement d'une application **FastAPI** est relativement simple.
 
index 5714a74cbb02623245308f8f28d9898d01ed6c36..67e5383ed925e5caab649b5c3be54724e15d3494 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -187,3 +188,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 39e5333426cde184b7aee9a9ca05e6de8ca1c884..b390875ea100e595bcf8e7d677846727ecdefff3 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 64e5ab876ca4a731d8feac3f315d9a3c995481eb..e5af7dd3090dbb0ef796e41facb8a2ad8e309725 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index acd93df48dfc7feeafc6e46eb3aadec0b0087e2d..6cc2cf0458bc395deb562226f542fb137a9911de 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 4074dff5a3659c67f36f088cf6335edd68de5720..f7de769eef9553702720ddc3c312e1c2796ec8fa 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 676f60359f78e61ff88e07d4076871509e4531a5..0732fc405acf4f38b945564c4c8c21c3391033d3 100644 (file)
@@ -1,4 +1,4 @@
-# ユーザーガイド 応用編
+# 高度なユーザーガイド
 
 ## さらなる機能
 
index 40710a93a1ab7486e7d2c680bc689253e8fec134..897956e38fb78d689e2658e646111d4864ecb962 100644 (file)
@@ -1,4 +1,4 @@
-# デプロイ - イントロ
+# デプロイ
 
 **FastAPI** 製のアプリケーションは比較的容易にデプロイできます。
 
index a2dd59c9b03cbbf477367addc414320f156543c1..856cde44b749141511f754630fe3a7e66f3770d6 100644 (file)
@@ -1,4 +1,4 @@
-# チュートリアル - ユーザーガイド - はじめに
+# チュートリアル - ユーザーガイド
 
 このチュートリアルは**FastAPI**のほぼすべての機能の使い方を段階的に紹介します。
 
index 56dc4ff4bb991c2f44af4f528c86204aa71c8b6b..f21d731f9598102ba2a91cd6956af9752894fa27 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -202,3 +203,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index d6db525e8dbd61c54724e2d65c2d473664b8e030..deb5ca8f27c4dc5eab54d91b2d9102b91903b116 100644 (file)
@@ -1,4 +1,4 @@
-# 자습서 - 사용자 안내서 - 도입부
+# 자습서 - 사용자 안내서
 
 이 자습서는 **FastAPI**의 대부분의 기능을 단계별로 사용하는 방법을 보여줍니다.
 
index d91f0dd12a5ee05e6d9b5309d129c062615322c2..0a1e6b639add63f9ce0b8508873853b7c842081c 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -172,3 +173,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 2ec3d6a2f7e7192b43414a42a69c79e0fc5bcecd..7f9253d6c645c57e4ded5ee7b489fd0fbd742637 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 52039bbb50f792f9b6046ba30668fef5d8970f8b..e74e1a6e339655f56161da1f54de6aa3bc957cc0 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index ed8752a95a6715508f842e857c0fb8a5eced6e3b..f8c5c602273f1137358de0c6cfbc08aa55f33be5 100644 (file)
@@ -1,4 +1,4 @@
-# Samouczek - Wprowadzenie
+# Samouczek
 
 Ten samouczek pokaże Ci, krok po kroku, jak używać większości funkcji **FastAPI**.
 
index 3b1e82c66e11e120824e39d6449dfc5648eef56f..588eddf97a2998c45a897feda0abcdad0dc003ad 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -162,3 +163,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index d1a57c6d17a4b49fa86f0aa2584bfd425101fa10..7e276f732ab6595d3a3c95ccd2c89292b7568ff3 100644 (file)
@@ -1,4 +1,4 @@
-# Guia de Usuário Avançado - Introdução
+# Guia de Usuário Avançado
 
 ## Recursos Adicionais
 
index 1ff0e44a092f78fc955b9fa6e1e2171de2f7cca9..6b4290d1d76ee35668930023d85958f1b08f63e4 100644 (file)
@@ -1,4 +1,4 @@
-# Implantação - Introdução
+# Implantação
 
 A implantação de uma aplicação **FastAPI** é relativamente simples.
 
index b1abd32bc19ab57eea6cc1130e2c26f01f5e6009..5fc0485a076d15b1c5019dcbde7550ea6d28e010 100644 (file)
@@ -1,4 +1,4 @@
-# Tutorial - Guia de Usuário - Introdução
+# Tutorial - Guia de Usuário
 
 Esse tutorial mostra como usar o **FastAPI** com a maior parte de seus recursos, passo a passo.
 
index 70f864040a6e0d57fa92bebd0e203f0d1b594829..f94a8ab626e35042fec97afcb31051d89b336f79 100644 (file)
@@ -1,4 +1,4 @@
-# Introdução à segurança
+# Segurança
 
 Há várias formas de lidar segurança, autenticação e autorização.
 
index fc933db943aa3ceb9f9abd788950f8b1a212dc82..54520642ef66a90483a1e66f0aac6472db2467af 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -199,3 +200,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 4dc4e482ed5c8f7de0f44e3c4a767db32467d8e2..d214a9d62e8525d53879038ae2d1b2993316921e 100644 (file)
@@ -1,4 +1,4 @@
-# Развёртывание - Введение
+# Развёртывание
 
 Развернуть приложение **FastAPI** довольно просто.
 
index 4277a6c4f1fa6215e1555989e96a8974d85fe947..ea3a1c37aed0ed31e99e3c98eb7039071f3a9039 100644 (file)
@@ -1,4 +1,4 @@
-# Учебник - Руководство пользователя - Введение
+# Учебник - Руководство пользователя
 
 В этом руководстве шаг за шагом показано, как использовать **FastApi** с большинством его функций.
 
index dbae5ac9553d9e6ceeda132bbdd272ae3b8600a9..66c7687b00c1ec29076693334b5a5fcbf9040e63 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -197,3 +198,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index d3038644fd7193fe0f6068865ad6ca9e4443e085..64f3dec2e33ed0829b30ac841120da75133bc6b6 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 1409b49dc773f99bb9095705ac75b12021baa62c..8604a06f6ce9ccaef5e2399803fcd806f709862e 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 5c63d659f12900d562486a6af297f67ed1391556..4000d9a41389475f01dc687a0c82188d40386b8c 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 125341fc690e62b019b0b0ab497b97d9265ab1c1..408b3ec2982e13a5c7f6a5e75327c4f9631bb19e 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -163,3 +164,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index 33e6fff400fa2c9b172b055d4b6b137855530028..49516cebf048f3eb34086dc7063132940100bbc9 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -158,3 +159,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
index d71838cd77e8d3c01e2d35408ddf375bca39bd33..824f91f47ba90d169951a502084751d82e8a92ad 100644 (file)
@@ -1,4 +1,4 @@
-# 高级用户指南 - 简介
+# 高级用户指南
 
 ## 额外特性
 
index 962523c09755d0e94dec44c2d56f2fe0f4c3f430..fdc8075c765ba04ecc8d9d176419bd629803d437 100644 (file)
@@ -1,4 +1,4 @@
-# 高级安全 - 介绍
+# 高级安全
 
 ## 附加特性
 
index c717da0f636f8ce9af4384a75d091d65715afcfb..7a133061de7973abe4d2ece7dfc82f808a023ec2 100644 (file)
@@ -1,4 +1,4 @@
-# 依赖项 - 第一步
+# 依赖项
 
 FastAPI 提供了简单易用,但功能强大的**<abbr title="也称为组件、资源、提供者、服务、可注入项">依赖注入</abbr>**系统。
 
index 6093caeb601cafccd9170e90f05fe9514e02bc6f..6180d3de399ae5133289c99c509f9ceeea827e02 100644 (file)
@@ -1,4 +1,4 @@
-# 教程 - 用户指南 - 简介
+# 教程 - 用户指南
 
 本教程将一步步向你展示如何使用 **FastAPI** 的绝大部分特性。
 
index 8f302a16c0d02b613d7191a8d92c7d3eac7c6e12..0595f5f63612972098e9d8b3efa56680375d9818 100644 (file)
@@ -1,4 +1,4 @@
-# 安全性简介
+# 安全性
 
 有许多方法可以处理安全性、身份认证和授权等问题。
 
index b64228d2c63e1fc03b14ccf0125d22a5d9449b03..39f989790e409560e5371aeea915a216773b1799 100644 (file)
@@ -23,6 +23,7 @@ theme:
   - search.suggest
   - search.highlight
   - content.tabs.link
+  - navigation.indexes
   icon:
     repo: fontawesome/brands/github-alt
   logo: https://fastapi.tiangolo.com/img/icon-white.svg
@@ -223,3 +224,5 @@ extra_css:
 extra_javascript:
 - https://fastapi.tiangolo.com/js/termynal.js
 - https://fastapi.tiangolo.com/js/custom.js
+hooks:
+- ../../scripts/mkdocs_hooks.py
diff --git a/scripts/mkdocs_hooks.py b/scripts/mkdocs_hooks.py
new file mode 100644 (file)
index 0000000..f09e9a9
--- /dev/null
@@ -0,0 +1,38 @@
+from typing import Any, List, Union
+
+from mkdocs.config.defaults import MkDocsConfig
+from mkdocs.structure.files import Files
+from mkdocs.structure.nav import Link, Navigation, Section
+from mkdocs.structure.pages import Page
+
+
+def generate_renamed_section_items(
+    items: List[Union[Page, Section, Link]], *, config: MkDocsConfig
+) -> List[Union[Page, Section, Link]]:
+    new_items: List[Union[Page, Section, Link]] = []
+    for item in items:
+        if isinstance(item, Section):
+            new_title = item.title
+            new_children = generate_renamed_section_items(item.children, config=config)
+            first_child = new_children[0]
+            if isinstance(first_child, Page):
+                if first_child.file.src_path.endswith("index.md"):
+                    # Read the source so that the title is parsed and available
+                    first_child.read_source(config=config)
+                    new_title = first_child.title or new_title
+            # Creating a new section makes it render it collapsed by default
+            # no idea why, so, let's just modify the existing one
+            # new_section = Section(title=new_title, children=new_children)
+            item.title = new_title
+            item.children = new_children
+            new_items.append(item)
+        else:
+            new_items.append(item)
+    return new_items
+
+
+def on_nav(
+    nav: Navigation, *, config: MkDocsConfig, files: Files, **kwargs: Any
+) -> Navigation:
+    new_items = generate_renamed_section_items(nav.items, config=config)
+    return Navigation(items=new_items, pages=nav.pages)