Skip to content

Conversation

@basnijholt
Copy link
Owner

Summary

  • Replace custom docs_gen.py with markdown-code-runner's built-in include_section() function
  • Delete custom_components/adaptive_lighting/docs_gen.py (84 lines removed)
  • Update all documentation files to use include_section() instead of readme_section()
  • Update dependency to use git version of markdown-code-runner (until v2.7.0 is released)

Changes

The built-in include_section(file, name, strip_heading=False) function provides the same functionality as the custom readme_section():

  • Extracts content between <!-- SECTION:name:START --> and <!-- SECTION:name:END --> markers
  • Optionally strips the first heading when strip_heading=True
  • Resolves file paths relative to the markdown file being processed

Test plan

  • Run markdown-code-runner on all docs files
  • Verify documentation site builds correctly
  • Check that all sections are extracted properly from README.md

Replace custom docs_gen.py with markdown-code-runner's built-in
include_section() function for extracting content from README.md.

Changes:
- Remove custom_components/adaptive_lighting/docs_gen.py
- Update all docs/*.md files to use include_section() instead of
  readme_section()
- Update pyproject.toml to use git version of markdown-code-runner
  (until v2.7.0 is released with include_section support)

The include_section() function provides the same functionality as
readme_section() - extracting content between SECTION markers and
optionally stripping the first heading.
The _transform_readme_links() function was needed to transform README
internal anchor links (like #gear-configuration) to docs site links
(like configuration.md). This restores the function and updates all
docs files that use include_section() with README.md to apply the
transformation.
Use single-line comment format for each code line instead of multi-line
blocks. The markdown-code-runner expects `<!-- code -->` on each line,
not `<!--\ncode\n-->` blocks.
@basnijholt basnijholt merged commit f9ccc94 into main Jan 26, 2026
23 checks passed
@basnijholt basnijholt deleted the migrate-to-include-section branch January 26, 2026 08:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants