笔记编辑规范
相关使用语法
Section titled “相关使用语法”frontmatter
Section titled “frontmatter”---title: 为每个页面提供标题description: 页面描述用于页面元数据,将被搜索引擎和社交媒体预览捕获。sidebar: label: 文字显示在侧边栏 order: 1 # 数字越小,链接组中显示得越高slug: edittableOfContents: minHeadingLevel: 2 maxHeadingLevel: 3lastUpdated: 2022-08-09# 从生产版本中排除此页面draft: true
---知识库进阶模板 (推荐版)
Section titled “知识库进阶模板 (推荐版)”---title: "Linux 性能优化实战"description: "涵盖 CPU、内存及 IO 调优的系统级指南"slug: "linux-performance-tuning"
# 1. 排序控制 (配合 sidebar 自动生成使用)sidebar: label: "性能优化" # 侧边栏显示的短标题(若不填则默认使用 title) order: 1 # 数字越小越靠前 badge: # 在侧边栏显示小标签 text: "核心" variant: "note" # note(蓝), tip(绿), caution(橙), danger(红), success(紫)
# 2. 内容状态管理lastUpdated: 2024-05-20 # 显式覆盖自动获取的时间editUrl: true # 是否显示“编辑此页”按钮
# 3. 页面布局自定义template: doc # 默认 doc,如果是引导页可以写 splashtableOfContents: # 局部控制目录显示 minHeadingLevel: 2 maxHeadingLevel: 3
# 4. 社交媒体与 SEOhead: - tag: meta attrs: property: og:image content: https://docs.isrv.cn---如何自动化应用这个模板?
Section titled “如何自动化应用这个模板?”为了提高效率,你可以结合 VS Code 用户代码片段 (Snippets) 使用:
- 在 VS Code 按
Ctrl+Shift+P,搜索 “Configure User Snippets”。 - 选择
markdown。 - 粘贴以下配置:
{ "Starlight Frontmatter": { "prefix": "fm", "body": [ "---", "title: ${1:标题}", "description: ${2:简短描述}", "slug: ${3:url-path}", "sidebar:", " order: ${4:10}", "---", "", "# ${1:标题}", "", "$0" ], "description": "生成 Starlight 笔记标准头部" }}