跳到主要内容

撰写文档

本文档包含为 Ent 文档网站贡献修改的指南。

Ent 文档网站由项目主 GitHub 代码库生成。

遵循以下简短指南来贡献文档改进和新增内容:

环境设置

  1. Fork 并本地克隆 主代码库

  2. 文档站点使用 Docusaurus。运行它需要安装 Node.js

  3. 安装依赖:

cd doc/website && npm install
  1. 在开发模式下运行网站:
cd doc/website && npm start
  1. 在浏览器中打开 http://localhost:3000

通用指南

  • 文档文件位于 doc/md 目录中,它们采用 Markdown 格式, 顶部带有 "front-matter" 风格的注解。 了解更多 关于 Docusaurus 文档格式的信息。
  • Ent 使用 Golang CommitMessage 格式来保持代码库历史记录的整洁和可读性。 因此,请使用类似如下的提交消息:
doc/md: adding a guide on contribution of docs to ent

添加新文档

  1. doc/md 目录中添加一个新的 Markdown 文件,例如 doc/md/writing-docs.md

  2. 文件应按如下格式编写:

---
id: writing-docs
title: Writing Docs
---
...

其中 id 应为文档的唯一标识符,应与不带 .md 后缀的文件名相同, 而 title 是文档的标题,它将显示在页面本身和站点上的任何导航元素中。

  1. 如果您希望页面出现在文档网站的侧边栏中,请将其 id 添加到 website/sidebars.js 中,例如:
{
type: 'category',
label: 'Misc',
items: [
'templates',
'graphql',
'sql-integration',
'testing',
'faq',
'generating-ent-schemas',
'feature-flags',
'translations',
'contributors',
+ 'writing-docs',
'slack'
],
collapsed: false,
},