基本配置¶
站点信息配置¶
站点名称和描述¶
site_name: My Documentation Site
site_url: https://example.com/docs
site_author: Your Name
site_description: Professional documentation for your project
版权信息¶
仓库集成¶
GitHub集成¶
编辑链接¶
这会在每个页面添加"编辑此页面"的链接。
目录结构配置¶
自定义文档目录¶
自定义输出目录¶
排除文件¶
主题配置¶
基本主题设置¶
theme:
name: material
language: zh-CN
palette:
- scheme: default
primary: 'blue'
accent: 'blue'
toggle:
icon: material/weather-night
name: 切换到深色模式
字体配置¶
导航配置¶
基本导航结构¶
nav:
- 首页: index.md
- 快速开始: quickstart.md
- 用户指南:
- 安装: guide/installation.md
- 配置: guide/configuration.md
- 使用: guide/usage.md
- API参考: api/
- 常见问题: faq.md
- 关于: about.md
嵌套导航¶
nav:
- 首页: index.md
- 用户指南:
- 入门:
- 安装: guide/getting-started/installation.md
- 快速开始: guide/getting-started/quickstart.md
- 进阶:
- 配置详解: guide/advanced/configuration.md
- 最佳实践: guide/advanced/best-practices.md
- 开发者:
- API文档: api/index.md
- 贡献指南: contributing.md
导航选项¶
theme:
features:
- navigation.tabs # 顶部标签导航
- navigation.sections # 侧边栏分组
- navigation.expand # 自动展开所有章节
- navigation.indexes # 自动生成索引页面
插件配置¶
搜索插件¶
Git修订日期¶
压缩插件¶
Markdown扩展配置¶
启用扩展¶
markdown_extensions:
- attr_list # 属性列表
- def_list # 定义列表
- footnotes # 脚注
- meta # 元数据
- toc: # 目录
permalink: true
高级扩展配置¶
markdown_extensions:
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.superfences:
custom_fences:
- name: mermaid
class: mermaid
format: !!python/name:pymdownx.superfences.fence_code_format
额外配置¶
社交媒体链接¶
extra:
social:
- icon: fontawesome/brands/github
link: https://github.com/your-username
name: GitHub
- icon: fontawesome/brands/twitter
link: https://twitter.com/your-username
name: Twitter
Google Analytics¶
自定义变量¶
环境配置¶
开发环境¶
生产环境¶
下一步: 主题定制