diff --git a/custom_components/adaptive_lighting/docs_gen.py b/custom_components/adaptive_lighting/docs_gen.py index 3cb45892..5cb0e992 100644 --- a/custom_components/adaptive_lighting/docs_gen.py +++ b/custom_components/adaptive_lighting/docs_gen.py @@ -84,9 +84,7 @@ def transform_readme_links(content: str) -> str: content = content.replace(f"]({old_link})", f"]({new_link})") # Also handle the ToC link pattern [[ToC](#...)] - content = re.sub(r"\[\[ToC\]\([^)]+\)\]", "", content) - - return content + return re.sub(r"\[\[ToC\]\([^)]+\)\]", "", content) def get_feature_list() -> str: diff --git a/docs/run_markdown_code_runner.py b/docs/run_markdown_code_runner.py deleted file mode 100644 index 8e5bdeb7..00000000 --- a/docs/run_markdown_code_runner.py +++ /dev/null @@ -1,95 +0,0 @@ -#!/usr/bin/env python3 -"""Run markdown-code-runner on all documentation files. - -This script processes all Markdown files in the docs/ directory that contain -CODE blocks, executing them and updating the OUTPUT sections. - -Usage: - python docs/run_markdown_code_runner.py -""" - -from __future__ import annotations - -import subprocess -import sys -from pathlib import Path - -# Add the custom_components to the path for imports -REPO_ROOT = Path(__file__).parent.parent -sys.path.insert(0, str(REPO_ROOT / "custom_components")) -sys.path.insert(0, str(REPO_ROOT)) - - -def find_markdown_files() -> list[Path]: - """Find all Markdown files in the docs directory.""" - docs_dir = REPO_ROOT / "docs" - return list(docs_dir.rglob("*.md")) - - -def has_code_blocks(file_path: Path) -> bool: - """Check if a Markdown file has CODE blocks.""" - content = file_path.read_text() - return ( - "" in content or "```python markdown-code-runner" in content - ) - - -def run_markdown_code_runner(file_path: Path) -> bool: - """Run markdown-code-runner on a single file.""" - try: - result = subprocess.run( - ["markdown-code-runner", str(file_path)], - capture_output=True, - text=True, - check=True, - env={ - **subprocess.os.environ, - "PYTHONPATH": f"{REPO_ROOT / 'custom_components'}:{REPO_ROOT}", - }, - ) - return True - except subprocess.CalledProcessError as e: - print(f" Error: {e.stderr}") - return False - except FileNotFoundError: - print( - " Error: markdown-code-runner not found. Install with: pip install markdown-code-runner", - ) - return False - - -def main() -> int: - """Process all Markdown files with CODE blocks.""" - print("Finding Markdown files with CODE blocks...") - - markdown_files = find_markdown_files() - files_with_code = [f for f in markdown_files if has_code_blocks(f)] - - if not files_with_code: - print("No files with CODE blocks found.") - return 0 - - print(f"Found {len(files_with_code)} files with CODE blocks:") - - success_count = 0 - failure_count = 0 - - for file_path in sorted(files_with_code): - relative_path = file_path.relative_to(REPO_ROOT) - print(f"\nProcessing {relative_path}...") - - if run_markdown_code_runner(file_path): - print(" ✓ Success") - success_count += 1 - else: - print(" ✗ Failed") - failure_count += 1 - - print(f"\n{'='*50}") - print(f"Results: {success_count} succeeded, {failure_count} failed") - - return 1 if failure_count > 0 else 0 - - -if __name__ == "__main__": - sys.exit(main()) diff --git a/zensical.toml b/zensical.toml index 7f3ccdd3..da94f77b 100644 --- a/zensical.toml +++ b/zensical.toml @@ -3,6 +3,7 @@ [project] name = "Adaptive Lighting" +site_name = "Adaptive Lighting" site_url = "https://adaptive-lighting.nijho.lt" repo_url = "https://github.com/basnijholt/adaptive-lighting" repo_name = "basnijholt/adaptive-lighting"