add home mdx

This commit is contained in:
2025-11-30 13:03:01 +08:00
parent 769f15aaf2
commit ecca716c83
6 changed files with 552 additions and 480 deletions

View File

@@ -29,10 +29,10 @@ export default defineConfig({
// 添加 remark 插件 // 添加 remark 插件
], ],
rehypePlugins: [ rehypePlugins: [
// 添加 rehype 插件 // 添加 rehype 插件
], ],
// 启用 MDX 表达式 // 启用 MDX 表达式
optimize: true, optimize: true
}), }),
react(), // react(), //
// sitemap(), // sitemap must be site has a domain // sitemap(), // sitemap must be site has a domain

View File

@@ -16,39 +16,39 @@
"license": "MIT", "license": "MIT",
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@astrojs/mdx": "^4.3.7", "@astrojs/mdx": "^4.3.12",
"@astrojs/react": "^4.4.0", "@astrojs/react": "^4.4.2",
"@astrojs/sitemap": "^3.6.0", "@astrojs/sitemap": "^3.6.0",
"@kevisual/query": "^0.0.29", "@kevisual/query": "^0.0.29",
"@kevisual/query-login": "^0.0.6", "@kevisual/query-login": "^0.0.7",
"@kevisual/registry": "^0.0.1", "@kevisual/registry": "^0.0.1",
"@tailwindcss/vite": "^4.1.14", "@tailwindcss/vite": "^4.1.17",
"astro": "^5.14.5", "astro": "^5.16.3",
"class-variance-authority": "^0.7.1", "class-variance-authority": "^0.7.1",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"dayjs": "^1.11.18", "dayjs": "^1.11.19",
"lodash-es": "^4.17.21", "lodash-es": "^4.17.21",
"lucide-react": "^0.546.0", "lucide-react": "^0.555.0",
"nanoid": "^5.1.6", "nanoid": "^5.1.6",
"react": "^19.2.0", "react": "^19.2.0",
"react-dom": "^19.2.0", "react-dom": "^19.2.0",
"react-toastify": "^11.0.5", "react-toastify": "^11.0.5",
"tailwind-merge": "^3.3.1", "tailwind-merge": "^3.4.0",
"zustand": "^5.0.8" "zustand": "^5.0.9"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"devDependencies": { "devDependencies": {
"@kevisual/types": "^0.0.10", "@kevisual/types": "^0.0.10",
"@types/react": "^19.2.2", "@types/react": "^19.2.7",
"@types/react-dom": "^19.2.2", "@types/react-dom": "^19.2.3",
"@vitejs/plugin-basic-ssl": "^2.1.0", "@vitejs/plugin-basic-ssl": "^2.1.0",
"dotenv": "^17.2.3", "dotenv": "^17.2.3",
"tailwindcss": "^4.1.14", "tailwindcss": "^4.1.17",
"tw-animate-css": "^1.4.0" "tw-animate-css": "^1.4.0"
}, },
"packageManager": "pnpm@10.18.3", "packageManager": "pnpm@10.24.0",
"onlyBuiltDependencies": [ "onlyBuiltDependencies": [
"@tailwindcss/oxide", "@tailwindcss/oxide",
"esbuild", "esbuild",

954
docs/pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
---
import '../styles/global.css';
export interface Props {
title?: string;
description?: string;
}
const { title, description } = Astro.props;
---
<html lang="zh-CN">
<head>
<meta charset="UTF-8" />
<title>{title || '文档'}</title>
<script src="https://cdn.tailwindcss.com"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/github-markdown-css/5.2.0/github-markdown.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.8.0/styles/github-dark.min.css">
</head>
<body class="bg-gray-50 min-h-screen">
<div class="container mx-auto px-4 py-8 max-w-4xl">
<article class="markdown-body bg-white rounded-lg shadow-lg p-8">
<slot />
</article>
</div>
</body>
</html>

View File

@@ -1,3 +1,9 @@
---
title: "Home 配置文档"
description: "Home Assistant 自动化配置文档"
layout: ../layouts/MDXPost.astro
---
# home配置文档 # home配置文档
## configuration.yaml ## configuration.yaml
@@ -5,6 +11,7 @@
配置调用rest_command服务文件地址在 docker 内部根目录下,`config/configuration.yaml` 位置 配置调用rest_command服务文件地址在 docker 内部根目录下,`config/configuration.yaml` 位置
添加以下内容 添加以下内容
```yaml ```yaml
rest_command: rest_command:
set_floor_notify: set_floor_notify:
@@ -12,8 +19,8 @@ rest_command:
method: POST method: POST
content_type: application/json content_type: application/json
``` ```
然后配置脚本位置 `config/scripts.yaml` 文件,添加以下内容
(scripts 被 configuration.yaml 引用) 然后配置脚本位置 `config/scripts.yaml` 文件,添加以下内容(scripts 被 configuration.yaml 引用
```yaml ```yaml
notify_floor: notify_floor:
@@ -22,7 +29,9 @@ notify_floor:
sequence: sequence:
- service: rest_command.set_floor_notify - service: rest_command.set_floor_notify
``` ```
## 触发使用 ## 触发使用
home 可视化页面可以编辑自动化,编辑后台也可以,在 automations.yaml 文件中添加以下类似内容 home 可视化页面可以编辑自动化,编辑后台也可以,在 automations.yaml 文件中添加以下类似内容
```yaml ```yaml

View File

@@ -1,3 +1,8 @@
---
title: "Python 代码示例"
description: "SIP 消息发送和 FastAPI 服务示例"
---
# python 代码示例 # python 代码示例
```sh ```sh
@@ -122,9 +127,9 @@ async def router(path: str = Query(...)):
result = await test() result = await test()
else: else:
return {"error": f"Unknown path: {path}"} return {"error": f"Unknown path: {path}"}
return {"success": True, "data": result} return {"success": True, "data": result}
except Exception as e: except Exception as e:
return {"success": False, "error": str(e)} return {"success": False, "error": str(e)}