Markdown front matter
Markdown文档可以使用一下元数据配置字段, 使用 ---
包裹:
字段名 | 字段值类型 | 缺省值 | 描述 |
---|---|---|---|
id | string | 文件路径 (包含文件夹路径, 从docs 目录开始, 不包含扩展名) | 文档的唯一标识. |
title | string | Markdown 标题 或者 id | 文档的标题, 也是站点的其他地方(sidebar, next/previous buttons)引用该文档的回退文案. 该标题会自动添加到文档的顶部, 并使用<h1 /> 标记包裹 |
pagination_label | string | sidebar_label 或者 title | 该文本用于文档 next/previous buttons 上. |
sidebar_label | string | title | sidebar显示的文本 |
sidebar_position | number | 默认排序 | 当使用文档自动生成特性时, 该值用于重写自动生成的文档的位置(position)值 |
sidebar_class_name | string | undefined | 给自动生成后的文档的label标签增加特定的class名称 |
hide_title | boolean | false | 是否隐藏文档标题, 只会隐藏元数据title 配置的标题. |
hide_table_of_contents | boolean | false | 是否隐藏文档右边的目录 |
toc_min_heading_level | number | 2 | 文档右边目录结构中支持显示的最小标题级别, 值必须大于2, 小于等于6 |
toc_max_heading_level | number | 3 | 文档右边目录结构中支持显示的最大标题级别, 值必须在 2 和 6之间 |
pagination_next | string / null | Next doc in the sidebar | 文档 Next 按钮链接的文档id, 使用 null 禁用 Next 按钮 |
pagination_prev | string / null | Previous doc in the sidebar | 文档中 Previous 按钮链接的文档id, 使用 null 禁用该按钮 |
parse_number_prefixes | boolean | 默认值参考插件的选项: numberPrefixParser | 是否禁用文档名前缀格式化 |
custom_edit_url | string | 根据插件 editUrl 选项自动计算 | 文档编辑链接 |
keywords | string[] | undefined | 文档生成页面的 Keywords meta tag, 用于搜索引擎抓取 |
description | string | Markdown文档第一行内容 | 用于文档 <head /> 生成对应 <meta /> |
image | string | undefined | 文档封面缩略图 |
slug | string | 文件路径(不包含扩展名) | 支持自定义路径: /<routeBasePath>/<slug> . 指定多种模式: slug: my-doc , slug: /my/path/myDoc , slug: / . |
tags | Tag[] | undefined | 文档标签, 每个tag对象有两个字段: label 和 permalink |
draft | boolean | false | 用来表示文档是否完成可发布 |
Tag
字段类型定义:
type Tag = string | {label: string; permalink: string};
示例:
---
id: doc-markdown
title: Docs Markdown Features
hide_title: false
hide_table_of_contents: false
sidebar_label: Markdown
sidebar_position: 3
pagination_label: Markdown features
custom_edit_url: https://github.com/facebook/docusaurus/edit/main/docs/api-doc-markdown.md
description: How do I find you when I cannot solve this problem
keywords:
- docs
- docusaurus
image: https://i.imgur.com/mErPwqL.png
slug: /myDoc
---
# Markdown Features
My Document Markdown content