Skip to content
Myr

👷 Upgrade build docs configs (#914)

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sebastián Ramírez · committed by GitHub · parent b24cf43 · Browse files · 10 files+137 added−38 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

10 files+137 added−38 removed

  • other:+137 added−38 removed

10 files+137 added−38 removed

modified:.github/workflows/build-docs.yml+8 added-6 removed
modified:docs/css/termynal.css+1 added
24 unmodified lines
25 padding: 75px 45px 35px;26 position: relative;27 -webkit-box-sizing: border-box;28 box-sizing: border-box;29 /* Custom line-height */30 line-height: 1.2;31}3233[data-termynal]:before {
78 unmodified lines
modified:docs/js/custom.js+3 added-1 removed
108 unmodified lines
109async function main() {110 setupTermynal()111}112113document$.subscribe(() => {113main()114 main()115})
modified:docs/js/termynal.js-1 removed
247 unmodified lines
248 } else if (prop !== 'value') {249 attrs += `${this.pfx}-${prop}="${line[prop]}" `250 }251 }252252 return attrs;253 }254}255
8 unmodified lines
modified:scripts/docs.py+5 added-6 removed
5 unmodified lines
6from http.server import HTTPServer, SimpleHTTPRequestHandler7from importlib import metadata8from pathlib import Path910import mkdocs.commands.build11import mkdocs.commands.serve12import mkdocs.config13import mkdocs.utils10import typer1112logging.basicConfig(level=logging.INFO)13
74 unmodified lines
88 Takes an optional LANG argument with the name of the language to serve, by default89 en.90 """91 # Enable line numbers during local development to make it easier to highlight96 os.environ["LINENUMS"] = "true"97 mkdocs.commands.serve.serve(dev_addr="127.0.0.1:8008")92 subprocess.run(93 ["mkdocs", "serve", "--dev-addr", "127.0.0.1:8008", "--dirty"],94 env={**os.environ, "LINENUMS": "true"},95 check=True,96 )979899@app.command()100def build() -> None:
36 unmodified lines
added:scripts/mkdocs_hooks.py+38 added
1from typing import Any, List, Union23from mkdocs.config.defaults import MkDocsConfig4from mkdocs.structure.files import Files5from mkdocs.structure.nav import Link, Navigation, Section6from mkdocs.structure.pages import Page789def generate_renamed_section_items(10 items: List[Union[Page, Section, Link]], *, config: MkDocsConfig11) -> List[Union[Page, Section, Link]]:12 new_items: List[Union[Page, Section, Link]] = []13 for item in items:14 if isinstance(item, Section):15 new_title = item.title16 new_children = generate_renamed_section_items(item.children, config=config)17 first_child = new_children[0]18 if isinstance(first_child, Page):19 if first_child.file.src_path.endswith("index.md"):20 # Read the source so that the title is parsed and available21 first_child.read_source(config=config)22 new_title = first_child.title or new_title23 # Creating a new section makes it render it collapsed by default24 # no idea why, so, let's just modify the existing one25 # new_section = Section(title=new_title, children=new_children)26 item.title = new_title27 item.children = new_children28 new_items.append(item)29 else:30 new_items.append(item)31 return new_items323334def on_nav(35 nav: Navigation, *, config: MkDocsConfig, files: Files, **kwargs: Any36) -> Navigation:37 new_items = generate_renamed_section_items(nav.items, config=config)38 return Navigation(items=new_items, pages=nav.pages)
modified:mkdocs.insiders.yml+5 added-1 removed
modified:mkdocs.yml+67 added-17 removed
24 unmodified lines
25 toggle:26 icon: material/lightbulb-outline27 name: Switch to system preference28 features:29 - search.suggest30 - search.highlight29 - content.code.annotate30 - content.code.copy31 # - content.code.select32 - content.footnote.tooltips33 - content.tabs.link32 - navigation.indexes34 - content.tooltips35 - navigation.footer36 - navigation.indexes37 - navigation.instant38 - navigation.instant.prefetch39 - navigation.instant.preview40 - navigation.instant.progress41 - navigation.path35 - content.code.annotate36 - content.code.copy37 - content.code.select42 # - navigation.tabs43 # - navigation.tabs.sticky44 - navigation.top45 - navigation.tracking46 - search.highlight47 - search.share48 - search.suggest49 - toc.follow5051 icon:52 repo: fontawesome/brands/github-alt53 logo: img/icon.svg54 favicon: img/favicon.png55 language: en56repo_name: tiangolo/typer57repo_url: https://github.com/tiangolo/typer46edit_uri: ""58plugins:59 # Material for MkDocs48 search: null60 search:61 social:62 # Other plugins63 redirects:64 redirect_maps:65 typer-cli.md: tutorial/typer-command.md66
67 unmodified lines
134 - contributing.md135 - release-notes.md136137markdown_extensions:138 # Python Markdown139 abbr:140 attr_list:141 footnotes:142 md_in_html:143 tables:144 toc:145 permalink: true126 markdown.extensions.attr_list:127 markdown.extensions.tables:128 markdown.extensions.md_in_html:146147 # Python Markdown Extensions148 pymdownx.betterem:149 smart_enable: all150 pymdownx.caret:151 pymdownx.highlight:152 line_spans: __span153 pymdownx.inlinehilite:154 pymdownx.keys:155 pymdownx.mark:156 pymdownx.superfences:157 custom_fences:158 - name: mermaid159 class: mermaid134 format: !!python/name:pymdownx.superfences.fence_code_format ''135 pymdownx.betterem:136 pymdownx.blocks.details:160 format: !!python/name:pymdownx.superfences.fence_code_format161 pymdownx.tilde:162163 # pymdownx blocks164 pymdownx.blocks.admonition:165 types:166 - note140 - info167 - attention168 - caution169 - danger170 - error171 - tip172 - hint173 - warning143 - danger144 - check174 # Custom types175 - info176 pymdownx.blocks.details:177 pymdownx.blocks.tab:178 alternate_style: True179180 # Other extensions181 mdx_include:182 base_path: docs183184extra:185 analytics:186 provider: google187 property: G-T78C5GNRXK188 feedback:189 title: Was this page helpful?190 ratings:191 - icon: material/emoticon-happy-outline192 name: This page was helpful193 data: 1194 note: >-195 Thanks for your feedback!196 - icon: material/emoticon-sad-outline197 name: This page could be improved198 data: 0199 note: >-200 Thanks for your feedback!201 social:202 - icon: fontawesome/brands/github-alt203 link: https://github.com/tiangolo/typer204 - icon: fontawesome/brands/twitter
13 unmodified lines
218219extra_javascript:220 - js/termynal.js221 - js/custom.js222223hooks:224 - scripts/mkdocs_hooks.py
added:requirements-docs-insiders.txt+3 added
1git+https://${TOKEN}@github.com/squidfunk/mkdocs-material-insiders.git@9.5.30-insiders-4.53.112git+https://${TOKEN}@github.com/pawamoy-insiders/griffe-typing-deprecated.git3git+https://${TOKEN}@github.com/pawamoy-insiders/mkdocstrings-python.git
modified:requirements-docs.txt+7 added-6 removed
1-e .23mkdocs-material==9.4.73mkdocs-material==9.5.184mdx-include >=1.4.1,<2.0.05mkdocs-markdownextradata-plugin >=0.1.7,<0.3.05mkdocs-redirects>=1.2.1,<1.3.06pyyaml >=5.3.1,<7.0.07# For Material for MkDocs, Chinese search8# jieba==0.42.19# For image processing by Material for MkDocs10pillow==10.3.011# For image processing by Material for MkDocs13cairosvg==2.7.014mkdocstrings[python]==0.23.015griffe-typingdoc==0.2.212cairosvg==2.7.113# mkdocstrings[python]==0.25.114# Enable griffe-typingdoc once dropping Python 3.7 and upgrading typing-extensions15# griffe-typingdoc==0.2.516# For griffe, it formats with black17black==24.3.017# black==24.3.018mkdocs-macros-plugin==1.0.5