-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[automations] Add anchor and fix regex for anchors #5527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR fixes the anchor shortcode parsing in the markdown processing script and adds a missing anchor to the automations documentation page. The regex pattern was incorrectly escaped and too permissive in what it matched within the anchor ID, which could cause issues when processing anchor shortcodes. Additionally, the automations index page was missing an anchor that other documentation pages reference.
- Fixed regex pattern in
md_anchors.pyto properly match anchor shortcode syntax - Added missing "automation" anchor to the automations documentation index page
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| script/md_anchors.py | Fixed regex pattern for matching anchor shortcodes by correcting escape sequences and tightening ID matching |
| content/automations/_index.md | Added missing "automation" anchor shortcode to enable proper cross-references |
✅ Deploy Preview for esphome ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdded an anchor shortcode to the automations index page, tightened the anchor-shortcode regex in the markdown anchor parser, and removed several action-related documentation sections from the MAX7219 digit display page. Changes
Sequence Diagram(s)sequenceDiagram
participant Author as Content author
participant MD as Markdown files
participant Parser as script/md_anchors.py
participant Site as Generated site
Note over Author,MD: Author edits markdown
Author->>MD: Add/remove anchor shortcodes and doc sections
MD->>Parser: Files passed to md_anchors.py (parsing anchors)
Note right of Parser: New regex matches only non-space/non-> chars\ninside quotes
Parser-->>Site: Emits recognized anchors/metadata
Site-->>Author: Rendered pages with updated anchors and content
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
💤 Files with no reviewable changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
content/automations/_index.md(1 hunks)script/md_anchors.py(1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**
⚙️ CodeRabbit configuration file
- Do not generate or add any sequence diagrams
Files:
content/automations/_index.mdscript/md_anchors.py
🔇 Additional comments (1)
content/automations/_index.md (1)
10-11: LGTM! Clean anchor addition.The anchor shortcode is properly formatted with a clear, simple ID that matches the new regex pattern in the parser script.
Description:
Related issue (if applicable): fixes https://discord.com/channels/429907082951524364/930955987584684102/1431418211714207904
And is a simpler alternative to #5490
Pull request in esphome with YAML changes (if applicable):
Checklist:
I am merging into
nextbecause this is new documentation that has a matching pull-request in esphome as linked above.or
I am merging into
currentbecause this is a fix, change and/or adjustment in the current documentation and is not for a new component or feature.Link added in
/components/index.rstwhen creating new documents for new components or cookbook.New Component Images
If you are adding a new component to ESPHome, you can automatically generate a standardized black and white component name image for the documentation.
To generate a component image:
Comment on this pull request with the following command, replacing
COMPONENT_NAMEwith your component name in UPPER_CASE format with underscores (e.g.,BME280,SHT3X,DALLAS_TEMP):The ESPHome bot will respond with a downloadable ZIP file containing the SVG image.
Extract the SVG file and place it in the
images/folder of this repository.Use the image in your component's index table entry in
/components/index.rst.Example: For a component called "DHT22 Temperature Sensor", use: