配置文件说明

配置文件可以添加设置网站内容和主题等。

添加配置

目前有三种配置,每种配置方式都起不通的作用,都不是必要的配置,配置格式均使用 yaml。三种配置:

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


## Website logo icon
## defalut: `data:image/png;base64,iVBOR......`
# -----------------------
logo: ./logo.png


## Website favicon icon
## defalut: `data:image/png;base64,iVBOR......`
# -----------------------
favicon: ./logo.png


## 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 旁边显示的文本。

自定义网站的导航菜单 logo,默认内置了 logo

favicon

自定义网站的 favicon 图标,默认内置了图标。

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:
  # 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

🚧 注意这个 scope 范围,如果没有任何菜单定义,将在所有页面展示 SiderBar 左侧边菜单栏。如果你定义了 scope,你定义的菜单路由在范围内,将在侧边栏展示。SiderBar 需要在 idoc.chapters.yml 中定义,并且需要定义 menus

页脚自定义。

footer: |
  Released under the MIT License. Copyright © 2022 Kenny Wong<br />
  Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a>

idoc.chapters.yml

定义左侧边栏(SiderBar)菜单

- introduce/getting-started: 入门
- introduce/getting-started/installation.md: 安装
- introduce/getting-started/publish.md: 发布网站
- introduce/getting-started/site-creation.md: 创建网站
- introduce/getting-started/site-preparation.md: 网站准备
- introduce/api: API
- introduce/api/command.md: 命令
- introduce/api/config.md: 配置文件说明

注释配置

这种配置是指在 markdown 文档中添加的配置,主要用于控制类似于 tocs 页面导航是否显示,页面标题展示,翻页等功能。

配置方法

在 markdown 文本中添加一条特定标记(<!--idoc:config:<您的配置>-->)的注视,将 yaml 格式的配置添加到注释中即可:

<!--idoc:config:
tocs: false
-->

详细配置说明

# 页面目录隐藏
tocs: false
# 当前页面网站名称,可以全局 `idoc.yml` 中配置
# 🚧 Logo 旁边的 <网站名称>,和 <title> 的名称配置
# 可以全局 `idoc.yml` 中配置,
# 都没有配置在 `package.json` 中读取 `name` 字段信息
site: 网站名称
# 在浏览器标签处显示的内容
# 默认 Markdown 文档第一个标题 <h1>
title: 网页标题
# 对网页的一个简单概述,默认获取当前 Markdown 页面第一段文本
description: 网页简述
# 搜索引擎能搜索到的关键词,每个关键词之间用逗号,隔开,必须是英文的逗号。
keywords: 关键词
# 当前页面<页脚>配置
footer: |
  Released under the MIT License. Copyright © 2022 Kenny Wong<br />
  Generated by <a href="https://github.com/jaywcjlove/idoc" target="_blank">idoc</a>
# 🚧 当前文件信息,不准确,比如 CI 在服务端生成,没有办法记录 修改时间。
fileStat:
  # 配置当前文档的修改时间,展示在页脚
  mtimeStr: 2022/04/13