mirror of
https://gitea.com/gitea/docs.git
synced 2026-03-27 14:11:03 +07:00
Add frontmatter and TOC rendering support for markdown files (#284)
<https://github.com/go-gitea/gitea/issues/14411#issuecomment-764871702> Reviewed-on: https://gitea.com/gitea/docs/pulls/284 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: dangjinghao <dangjinghaoemail@163.com> Co-committed-by: dangjinghao <dangjinghaoemail@163.com>
This commit is contained in:
@@ -100,3 +100,26 @@ Using code-block with language:
|
||||
\alpha
|
||||
```
|
||||
````
|
||||
|
||||
## Frontmatter
|
||||
|
||||
Gitea supports frontmatter and Table of Contents (TOC) rendering. By default, frontmatter rendering is enabled, and TOC rendering is disabled.
|
||||
|
||||
### Enabling TOC rendering
|
||||
|
||||
To enable TOC rendering for a markdown file, add `include_toc: true` to its frontmatter section.
|
||||
|
||||
### Disabling frontmatter
|
||||
|
||||
To disable frontmatter rendering for a markdown file, add `gitea: none` to its frontmatter section.
|
||||
|
||||
### Example
|
||||
|
||||
```yaml
|
||||
---
|
||||
include_toc: true
|
||||
gitea: none
|
||||
---
|
||||
```
|
||||
|
||||
Then, when you preview this markdown file in Gitea, the frontmatter section will not be rendered, and a Table of Contents will be generated at the top of the content.
|
||||
|
||||
Reference in New Issue
Block a user