Skip to content

Conversation

@clydebarrow
Copy link
Contributor

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):

  • esphome/esphome#

Checklist:

  • I am merging into next because this is new documentation that has a matching pull-request in esphome as linked above.
    or

  • I am merging into current because 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.rst when 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:

  1. Comment on this pull request with the following command, replacing COMPONENT_NAME with your component name in UPPER_CASE format with underscores (e.g., BME280, SHT3X, DALLAS_TEMP):

    @esphomebot generate image COMPONENT_NAME
    
  2. The ESPHome bot will respond with a downloadable ZIP file containing the SVG image.

  3. Extract the SVG file and place it in the images/ folder of this repository.

  4. Use the image in your component's index table entry in /components/index.rst.

Example: For a component called "DHT22 Temperature Sensor", use:

@esphomebot generate image DHT22

Copilot AI review requested due to automatic review settings October 26, 2025 00:51
Copy link
Contributor

Copilot AI left a 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.py to 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

@esphome esphome bot added the current label Oct 26, 2025
@netlify
Copy link

netlify bot commented Oct 26, 2025

Deploy Preview for esphome ready!

Name Link
🔨 Latest commit cfe042b
🔍 Latest deploy log https://app.netlify.com/projects/esphome/deploys/68fd7269e26eea000894f9ee
😎 Deploy Preview https://deploy-preview-5527--esphome.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 26, 2025

Walkthrough

Added 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

Cohort / File(s) Summary
Content: Automations index
content/automations/_index.md
Inserted anchor shortcode {{< anchor "automation" >}} at the top of the page before the intro text.
Parser: Anchor shortcode regex
script/md_anchors.py
Tightened shortcode regex to capture only non-space, non-">" characters inside quotes (restricts which anchor IDs are recognized).
Content: MAX7219 display docs
content/components/display/max7219digit.md
Removed several action-related sections and their anchors (invert_on/invert_off, turn_on/turn_off, reverse_on/reverse_off, intensity), deleting corresponding Action headings/anchors.

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
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to script/md_anchors.py regex change: verify existing anchor IDs (esp. those with spaces or special chars) still behave as intended and CI/site generation tests pass.
  • Review content/components/display/max7219digit.md deletions to ensure no broken cross-links or references remain elsewhere.

Possibly related PRs

Suggested reviewers

  • jesserockz

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Title Check ✅ Passed The title "[automations] Add anchor and fix regex for anchors" directly relates to two of the three main file changes in the pull request: adding an anchor shortcode to the automations index page and modifying the anchor regex in the script. However, the title does not capture the significant documentation removals from the max7219digit.md file, where several action-related sections and their anchors were deleted. The title does align with the stated objectives in the PR description ("adds an anchor and fixes the regex used for anchors"), making it a partially related but incomplete representation of the full changeset.
Description Check ✅ Passed The pull request description clearly relates to the changeset by explaining that it "Adds an anchor and fixes the regex used for anchors in the documentation." The description provides context about the change being a fix to current documentation rather than a new feature, references a related Discord issue, and notes this is a simpler alternative to a previous approach. The description directly addresses the purpose and scope of the changes made across the files in the pull request.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a7abd3e and cfe042b.

📒 Files selected for processing (1)
  • content/components/display/max7219digit.md (0 hunks)
💤 Files with no reviewable changes (1)
  • content/components/display/max7219digit.md

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7dbc603 and a7abd3e.

📒 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.md
  • script/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.

@swoboda1337 swoboda1337 merged commit 7916da7 into esphome:current Oct 27, 2025
4 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Oct 28, 2025
@clydebarrow clydebarrow deleted the automation-anchor branch November 4, 2025 22:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants