-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix devcontainer for markdown/hugo #5293
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
base: current
Are you sure you want to change the base?
Fix devcontainer for markdown/hugo #5293
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 development container configuration to work with the documentation's migration from reStructuredText/Sphinx to Markdown/Hugo. The changes ensure developers can properly build and preview the documentation locally.
Key changes:
- Updates development environment to support Hugo static site generator
- Adds required tooling (npm, Hugo, markdownlint) for the new documentation stack
- Configures automatic pre-commit hook installation
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
.devcontainer/postCreate.sh |
Adds pre-commit installation and setup |
.devcontainer/devcontainer.json |
Configures Hugo, Node.js, and markdownlint extension with updated port forwarding |
pip3 install --upgrade pre-commit | ||
pre-commit install |
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.
Consider adding error handling for the pre-commit commands. If pre-commit installation fails, the subsequent install command will also fail. You could add set -e
at the top of the script to exit on any command failure, or add explicit error checking for each command.
Copilot uses AI. Check for mistakes.
✅ Deploy Preview for esphome ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughUpdated devcontainer to forward port 1313, add Node and Hugo features (Hugo v0.147.8), and include the markdownlint VS Code extension. Modified postCreate.sh to install and initialize pre-commit, removing PageFind CLI download, while keeping requirements installation. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant VSCode as VS Code
participant DevC as Dev Container
participant Post as postCreate.sh
participant Pip as pip3
VSCode->>DevC: Open in container
Note over DevC: Build container with features<br/>- node:1<br/>- hugo:1 (v0.147.8)<br/>Forward port: 1313
DevC-->>VSCode: Container ready
DevC->>Post: Run postCreate.sh
rect rgba(200,230,255,0.3)
Post->>Pip: install -r requirements.txt -r requirements_test.txt
Post->>Pip: install --upgrade pre-commit
Post->>Post: pre-commit install
end
Note over Post,DevC: PageFind CLI download removed
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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
🧹 Nitpick comments (1)
.devcontainer/postCreate.sh (1)
1-7
: Make the script fail-fast and deterministic.Minor hardening so devcontainer setup errors don’t get swallowed and Python tool installs target the right interpreter.
Apply this diff:
#!/bin/bash +set -Eeuo pipefail +# Optional: reduce noisy errors when a subshell exits (Bash 5.0+); ignore if unsupported. +shopt -s inherit_errexit || true + -python3 -m pip install -r requirements.txt -r requirements_test.txt -pip3 install --upgrade pre-commit -pre-commit install +python3 -m pip install -r requirements.txt -r requirements_test.txt +python3 -m pip install --upgrade pre-commit +# Pre-download hooks so first commit is fast. +pre-commit install --install-hooksIf you prefer to keep project deps isolated from the toolchain, consider installing pre-commit via pipx instead of mixing it into the project venv. Happy to provide a variant if you want it.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
.devcontainer/devcontainer.json
(1 hunks).devcontainer/postCreate.sh
(1 hunks)
🔇 Additional comments (4)
.devcontainer/postCreate.sh (1)
5-6
: Pre-commit bootstrap is a good addition for contributor ergonomics.Installing and initializing pre-commit in postCreate ensures hooks are present without asking contributors to do extra steps.
.devcontainer/devcontainer.json (3)
6-8
: Port 1313 forward is correct for Hugo’s dev server.Matches the default port that hugo server binds to, making preview reachable without extra config.
18-21
: Adding markdownlint is a nice DX improvement.Good default for a Markdown/Hugo repo; keeps formatting consistent in PRs.
6-8
: Sanity check complete: live-html target serves on port 1313The Makefile defines the live-html target as follows (lines 38–41):
live-html: $(PAGEFIND) hugo server --bind 0.0.0.0 --baseURL http://localhost:1313Hugo defaults to port 1313 when no
--port
flag is provided, so forwarding port 1313 is correct. No changes necessary.
"ghcr.io/devcontainers/features/hugo:1": { | ||
"version": "v0.147.8" // Matches version used in netlify.toml | ||
} |
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.
Fix Hugo feature version: drop the leading “v”.
The Dev Containers Hugo feature expects a plain semver (e.g., 0.147.8), not a tag with “v” prefix. Using “v0.147.8” will fail the feature install. Also, 0.147.8 is a valid Hugo release. (discourse.gohugo.io, github.com)
Apply this diff:
- "ghcr.io/devcontainers/features/hugo:1": {
- "version": "v0.147.8" // Matches version used in netlify.toml
- }
+ "ghcr.io/devcontainers/features/hugo:1": {
+ "version": "0.147.8", // Matches version used in netlify.toml
+ // Optional but recommended if the site uses SCSS/SASS (most themes do):
+ // installs the extended build of Hugo.
+ "extended": true
+ }
Notes:
- The “extended” option enables SCSS/SASS processing in themes; add it if your docs theme uses SCSS. (dev.to, theindiecoder.cloud)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
"ghcr.io/devcontainers/features/hugo:1": { | |
"version": "v0.147.8" // Matches version used in netlify.toml | |
} | |
"ghcr.io/devcontainers/features/hugo:1": { | |
"version": "0.147.8", // Matches version used in netlify.toml | |
// Optional but recommended if the site uses SCSS/SASS (most themes do): | |
// installs the extended build of Hugo. | |
"extended": true | |
} |
🤖 Prompt for AI Agents
.devcontainer/devcontainer.json around lines 12 to 14: the Hugo feature version
currently uses a “v” prefixed tag ("v0.147.8") which the Dev Containers feature
expects as a plain semver; remove the leading "v" to set "version": "0.147.8"
and (optionally) add the extended flag by including "extended": true so
SCSS/SASS support is available for themes that need it.
Description:
With the docs conversion to markdown/hugo, the devcontainer didn't work anymore.
This PR solves that by:
Makefile
forpagefind
)Additionally pre-commit hooks are now installed by default.
Related issue (if applicable): fixes
Pull request in esphome with YAML changes (if applicable):
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:
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
):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: