]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
🔨 Enable linenums in MkDocs Material during local live development to simplify highli...
authorSebastián Ramírez <tiangolo@gmail.com>
Fri, 30 Jun 2023 16:23:02 +0000 (18:23 +0200)
committerGitHub <noreply@github.com>
Fri, 30 Jun 2023 16:23:02 +0000 (18:23 +0200)
docs/en/mkdocs.maybe-insiders.yml
docs/en/mkdocs.yml
scripts/docs.py

index 8e62713345d0386e0e2ab7513f55051aeb90a327..37fd9338efc5f273e3e63d859e85b299d62e89e1 100644 (file)
@@ -1,3 +1,6 @@
 # Define this here and not in the main mkdocs.yml file because that one is auto
 # updated and written, and the script would remove the env var
 INHERIT: !ENV [INSIDERS_FILE, '../en/mkdocs.no-insiders.yml']
+markdown_extensions:
+  pymdownx.highlight:
+    linenums: !ENV [LINENUMS, false]
index 21300b9dcb1dc2edc4cc3d8a7eda8b38aa34a007..64dc4037278fb2d550b1a0b202abd8ca02a41aa5 100644 (file)
@@ -169,24 +169,24 @@ nav:
 - contributing.md
 - release-notes.md
 markdown_extensions:
-- toc:
+  toc:
     permalink: true
-- markdown.extensions.codehilite:
+  markdown.extensions.codehilite:
     guess_lang: false
-- mdx_include:
+  mdx_include:
     base_path: docs
-- admonition
-- codehilite
-- extra
-- pymdownx.superfences:
+  admonition:
+  codehilite:
+  extra:
+  pymdownx.superfences:
     custom_fences:
     - name: mermaid
       class: mermaid
       format: !!python/name:pymdownx.superfences.fence_code_format ''
-- pymdownx.tabbed:
+  pymdownx.tabbed:
     alternate_style: true
-- attr_list
-- md_in_html
+  attr_list:
+  md_in_html:
 extra:
   analytics:
     provider: google
index 20838be6a716a17b75bd6a9a71c23de0cb4f7cdf..968dd9a3d50096378b37c9c6388af9be5212df72 100644 (file)
@@ -258,6 +258,8 @@ def live(
     Takes an optional LANG argument with the name of the language to serve, by default
     en.
     """
+    # Enable line numbers during local development to make it easier to highlight
+    os.environ["LINENUMS"] = "true"
     if lang is None:
         lang = "en"
     lang_path: Path = docs_path / lang