Move "Developer Reference" to bottom in the nav bar

This commit is contained in:
SoftFever
2026-01-03 13:43:11 +08:00
parent bc3f9e7f04
commit deb5817a70
3 changed files with 19 additions and 16 deletions

View File

@@ -23,7 +23,7 @@ done
command -v mkdocs >/dev/null 2>&1 || { echo "Error: mkdocs is required but not installed."; exit 1; }
command -v python3 >/dev/null 2>&1 || { echo "Error: python3 is required but not installed."; exit 1; }
# python3 generate_nav.py --update
python3 generate_nav.py --update
echo "Building documentation with mkdocs..."

View File

@@ -95,7 +95,7 @@ def get_file_title(filepath: Path) -> str:
def get_sort_key(path: Path) -> tuple:
"""Generate a sort key for ordering files/folders."""
name = path.name.lower() if path.is_dir() else path.stem.lower()
# Priority ordering: basic/intro first, advanced/misc last
if any(x in name for x in ['index', 'home', 'intro', 'overview', 'guide']):
return (0, name)
@@ -105,7 +105,10 @@ def get_sort_key(path: Path) -> tuple:
return (8, name)
if any(x in name for x in ['other', 'misc', 'dependencies']):
return (9, name)
# Developer reference goes to the bottom
if name == 'developer-reference':
return (10, name)
return (5, name) # Default: middle priority, alphabetical
@@ -217,10 +220,10 @@ def update_mkdocs_yml(mkdocs_path: Path, nav_yaml: str) -> None:
content = mkdocs_path.read_text(encoding='utf-8')
# Find and replace the nav section
# Match nav: followed by indented content until next top-level key or EOF
# Match nav: followed by lines starting with - or whitespace until next top-level key or EOF
nav_pattern = re.compile(
r'^nav:\s*\n((?:[ \t]+.*\n)*?)(?=^[a-zA-Z]|\Z)',
re.MULTILINE | re.DOTALL
r'^nav:\s*\n((?:[ \t-].*\n)*)',
re.MULTILINE
)
match = nav_pattern.search(content)

View File

@@ -45,16 +45,6 @@ nav:
- "Filament Tolerance Calibration": "calibration/tolerance-calib.md"
- VFA: "calibration/vfa-calib.md"
- "Max Volumetric Speed (FlowRate) Calibration": "calibration/volumetric-speed-calib.md"
- "Developer Reference":
- "Localization and translation guide": "developer-reference/Localization_guide.md"
- "Placeholders Variables": "developer-reference/Built-in-placeholders-variables.md"
- "How to Build": "developer-reference/How-to-build.md"
- "Guide: Develop Profiles for OrcaSlicer": "developer-reference/How-to-create-profiles.md"
- "How to Test": "developer-reference/How-to-test.md"
- "How to Contribute to the Wiki": "developer-reference/How-to-wiki.md"
- "Application Structure Overview": "developer-reference/plater-sidebar-tab-combobox.md"
- "Preset and Bundle": "developer-reference/Preset-and-bundle.md"
- "Slicing Hierarchy": "developer-reference/slicing-hierarchy.md"
- "General Settings":
- "Keyboard Shortcuts": "general-settings/keyboard-shortcuts.md"
- "Material Settings":
@@ -143,3 +133,13 @@ nav:
- "Multimaterial setup": printer_settings/multimaterial/printer_multimaterial_setup.md
- "Wipe Tower": printer_settings/multimaterial/printer_multimaterial_wipe_tower.md
- "Advanced Multi-Material Settings": printer_settings/multimaterial/printer_multimaterial_advanced.md
- "Developer Reference":
- "Localization and translation guide": "developer-reference/Localization_guide.md"
- "Placeholders Variables": "developer-reference/Built-in-placeholders-variables.md"
- "How to Build": "developer-reference/How-to-build.md"
- "Guide: Develop Profiles for OrcaSlicer": "developer-reference/How-to-create-profiles.md"
- "How to Test": "developer-reference/How-to-test.md"
- "How to Contribute to the Wiki": "developer-reference/How-to-wiki.md"
- "Application Structure Overview": "developer-reference/plater-sidebar-tab-combobox.md"
- "Preset and Bundle": "developer-reference/Preset-and-bundle.md"
- "Slicing Hierarchy": "developer-reference/slicing-hierarchy.md"