配置文件可以添加设置网站内容和主题等。
目前有三种配置,每种配置方式都起不通的作用,都不是必要的配置,配置格式均使用 yaml。三种配置:
idoc.yml
,在根目录下添加,可不用配置。idoc.chapters.yml
,侧栏文件导航,在根目录下添加。注释配置
,在 markdown 文档中添加的配置。idoc.yml
## directory of document source files
## defalut: `docs`
# -----------------------
dir: docs
## output directory of generated documents
## defalut: `dist`
# -----------------------
output: dist
## site name
# -----------------------
site: iDoc
## Customize theme settings.
## defalut: `default`
# -----------------------
theme: default
## Template Data
# -----------------------
data:
# Show open source button
openSource: https://github.com/jaywcjlove/idoc
# Display the edit button, need to configure `openSource`.
editButton:
label: Edit this page on GitHub
url: https://github.com/jaywcjlove/idoc/blob/master/
# Navigation Menu.
menus:
# Label: <URL> [scope]
Docs: introduce/getting-started/installation.html introduce
Markdown: markdown.html
About: about.html
footer: |
Released under the MIT License. Copyright © 2022 Kenny Wong<br />
Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a>
dir
文档(markdown)所在的目录,默认配置当前项目根目录下的 docs
文件夹中。
output
文档(markdown)输出的 HTML 所在的目录,默认配置当前项目根目录下的 dist
文件夹中。
site
自定义网站的名称,也将用户导航菜单 logo 旁边显示的文本。
site: iDoc
如果你没有配置,将会自动读取 package.json
中的 name
字段
"name": "idoc",
theme
主题定制,默认值为 default
,你也可以自定义主题,可以使用 idoc init myapp
生成项目工程的时候,选择暴露模版文件,主题将被生成到 themes/default
目录中
## Customize theme settings.
## defalut: `default`
# -----------------------
theme: themes/default
data
默认主题模版变量传递。
openSource
默认页面顶部 GitHub 按钮菜单自定义。
openSource: https://github.com/jaywcjlove/idoc
如果你没有配置,将会自动读取 package.json
中的 repository
字段
"repository": {
"type": "git",
"url": "https://github.com/jaywcjlove/idoc.git"
},
editButton
默认页面 编辑按钮
定义。
editButton:
label: Edit this page on GitHub
url: https://github.com/jaywcjlove/idoc/blob/master/
menus
默认主题顶部导航菜单定义
menus:
# Label: <URL> [scope]
Docs: introduce/getting-started/installation.html introduce
Markdown: markdown.html
About: about.html
定义范围 scope
,下面示例定义了个范围 introduce
,这个范围表示,以 introduce
开头的页面,页面导航 Docs
选中效果。
menus:
# Label: <URL> [scope]
Docs: introduce/getting-started/installation.html introduce
footer
页脚自定义。
footer: |
Released under the MIT License. Copyright © 2022 Kenny Wong<br />
Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a>
这种配置是指在 markdown
文档中添加的配置,主要用于控制类似于 toc
页面导航是否显示,页面标题展示,翻页等功能。
在 markdown 文本中添加一条特定标记(<!--idoc:config:<您的配置>-->
)的注视,将 yaml 格式的配置添加到注释中即可:
<!--idoc:config:
tocs: false
-->
# 页面目录隐藏
tocs: false
# 当前页面网站名称,可以全局 `idoc.yml` 中配置
site: 当前页面网站名称
# ⚠️ Logo 旁边的 <网站名称>,当前页面范围,
# 可以全局 `idoc.yml` 中配置,
# 都没有配置在 `package.json` 中读取 `name` 字段信息
title: 网站名称
fileStat:
# 配置当前文档的修改时间,展示在页脚
mtimeStr: 2022/04/13
# 当前页面页脚配置
footer: |
Released under the MIT License. Copyright © 2022 Kenny Wong<br />
Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a>