Browse Source

🔨 Enable linenums in MkDocs Material during local live development to simplify highlighting code (#9769)

pull/9775/head
Sebastián Ramírez 2 years ago
committed by GitHub
parent
commit
0a8423d792
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      docs/en/mkdocs.maybe-insiders.yml
  2. 20
      docs/en/mkdocs.yml
  3. 2
      scripts/docs.py

3
docs/en/mkdocs.maybe-insiders.yml

@ -1,3 +1,6 @@
# Define this here and not in the main mkdocs.yml file because that one is auto # 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 # updated and written, and the script would remove the env var
INHERIT: !ENV [INSIDERS_FILE, '../en/mkdocs.no-insiders.yml'] INHERIT: !ENV [INSIDERS_FILE, '../en/mkdocs.no-insiders.yml']
markdown_extensions:
pymdownx.highlight:
linenums: !ENV [LINENUMS, false]

20
docs/en/mkdocs.yml

@ -169,24 +169,24 @@ nav:
- contributing.md - contributing.md
- release-notes.md - release-notes.md
markdown_extensions: markdown_extensions:
- toc: toc:
permalink: true permalink: true
- markdown.extensions.codehilite: markdown.extensions.codehilite:
guess_lang: false guess_lang: false
- mdx_include: mdx_include:
base_path: docs base_path: docs
- admonition admonition:
- codehilite codehilite:
- extra extra:
- pymdownx.superfences: pymdownx.superfences:
custom_fences: custom_fences:
- name: mermaid - name: mermaid
class: mermaid class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format '' format: !!python/name:pymdownx.superfences.fence_code_format ''
- pymdownx.tabbed: pymdownx.tabbed:
alternate_style: true alternate_style: true
- attr_list attr_list:
- md_in_html md_in_html:
extra: extra:
analytics: analytics:
provider: google provider: google

2
scripts/docs.py

@ -258,6 +258,8 @@ def live(
Takes an optional LANG argument with the name of the language to serve, by default Takes an optional LANG argument with the name of the language to serve, by default
en. en.
""" """
# Enable line numbers during local development to make it easier to highlight
os.environ["LINENUMS"] = "true"
if lang is None: if lang is None:
lang = "en" lang = "en"
lang_path: Path = docs_path / lang lang_path: Path = docs_path / lang

Loading…
Cancel
Save