Source for esphome.io documentation files.
npx skills add https://github.com/esphome/esphome-docs --skill pr-workflowقم بتثبيت هذه المهارة باستخدام واجهة سطر الأوامر (CLI) وابدأ في استخدام سير عمل SKILL.md في مساحة عملك.
This repository contains the source for the documentation site for ESPHome, built with Astro and Starlight.
The project follows the Astro/Starlight directory structure:
esphome-docs/
├── src/
│ ├── assets/ # Static assets (logos, etc.)
│ ├── components/ # Astro components
│ ├── content/
│ │ └── docs/ # MDX documentation files
│ ├── lib/ # Utility functions
│ └── styles/ # CSS files
├── public/
│ └── images/ # Shared images (multi-use, ImgTable)
├── astro.config.mjs # Astro configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Node.js dependencies
Images in the Astro/Starlight site are handled in two ways:
For images used in only one document:
import { Image } from 'astro:assets';
import myImageImg from './images/my-image.jpg';
<Image src={myImageImg} alt="Description" layout="constrained" />
images/ directory next to the MDX fileImg suffixFor images used in multiple documents or in ImgTable components:
<Image src="/images/shared-image.jpg" alt="Description" layout="constrained" />
/public/images//images//public/images/The ImgTable component creates grids of component cards (commonly used on index pages):
<ImgTable items={[
["Title", "/path/to/page/", "image.png"],
["Title 2", "/path/to/page2/", "image2.png", "caption"],
["Title 3", "/path/to/page3/", "image3.png", "caption", "dark-invert"],
]} />
All images referenced in ImgTable must be in /public/images/ as the component resolves them to /images/filename.png.
The site uses Starlight, a documentation framework built on Astro. Key features include:
Content is written in MDX, which allows you to use JSX components within Markdown:
---
title: "My Page Title"
description: "Page description for SEO"
---
import { Image } from 'astro:assets';
import myImageImg from './images/my-image.jpg';
# Heading
Regular Markdown content here.
<Image src={myImageImg} alt="Description" layout="constrained" />
Custom components are located in src/components/ and can be imported into MDX files:
Import and use components in MDX files:
import APIRef from '@components/APIRef.astro';
import Figure from '@components/Figure.astro';
import myImageImg from './images/my-image.jpg';
<APIRef text="component.h" path="component/component.h" />
<Figure src={myImageImg} alt="Description" caption="Optional caption" />
Use GitHub-flavored alert syntax for callouts:
> [!NOTE]
> This is important information that readers should pay attention to.
> [!IMPORTANT]
> This is helpful information that readers should be aware of.
> [!TIP]
> Helpful advice or best practices.
> [!WARNING]
> Important warnings or potential issues.
> [!CAUTION]
> Critical cautions that could cause damage.
LaTeX equations are supported using KaTeX:
Inline math: $E = mc^2$
Block equations:
$$
\text{formula} = \frac{a}{b}
$$
To run the site locally:
npm installnpm run devhttp://localhost:4321/npm run dev # Start development server
npm run build # Build for production
npm run preview # Preview production build locally
npm run astro # Run Astro CLI commands
npm run build
The built site will be in the dist/ directory.
See the GitHub workflows in .github/workflows for CI/CD configuration.
Contributions to improve the documentation are welcome! Please follow these steps:
npm run dev/public/images/ with absolute paths/public/images/layout="constrained" for responsive imagesThe ESPHome documentation is licensed under the
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
Documentation: https://esphome.io/
For issues, please go to the issue tracker.
For feature requests, please see feature requests.