Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

> 一个神奇的文档网站生成器。

## 概述
## 概述 :id=what-it-is

Docsify 可立即将你的 Markdown 文件转化为文档网站。 与其他大多数文档网站生成工具不同,它不需要生成 HTML 文件。 相反,它可以动态加载和解析 Markdown 文件,并将其显示为网站。 要开始使用它,只需创建一个 `index.html` 并将其[部署到 GitHub Pages](zh-cn/deploy.md)(查看[快速开始](zh-cn/quickstart.md)了解更多详情)。

## 特性
## 特性 :id=features

- 无需静态构建的 HTML 文件
- 简单和轻量
Expand All @@ -15,14 +15,14 @@ Docsify 可立即将你的 Markdown 文件转化为文档网站。 与其他大
- 丰富的 API
- 支持 Emoji

## 示例
## 示例 :id=examples

可以查看 [Showcase](https://github.com/docsifyjs/docsify/#showcase) 来了解更多在使用 docsify 的文档项目。
Check out the [Showcase](awesome?id=showcase) to see docsify in use.

## 捐赠
## 捐赠 :id=donate

如果你认为 docsify 对你有帮助,或者我的工作有价值,请考虑捐赠。 欢迎帮我[买杯咖啡](https://github.com/QingWei-Li/donate)。 :heart:

## 社区
## 社区 :id=community

在 [Discord](https://discord.gg/3NwKFyR) 的社区里可以找到 docsify 的用户和开发者团队。
12 changes: 6 additions & 6 deletions adding-pages.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 添加页面
# 添加页面 :id=adding-pages

如果你需要更多页面,你可以简单地在 docsify 目录中创建更多 markdown 文件。 如果创建了名为 `guide.md` 的文件,则可通过 `/#/guide` 访问该文件。

Expand All @@ -23,7 +23,7 @@ docs/zh-cn/README.md => http://domain.com/#/zh-cn/
docs/zh-cn/guide.md => http://domain.com/#/zh-cn/guide
```

## 侧边栏
## 侧边栏 :id=sidebar

为了拥有侧边栏,你可以创建自己的侧边栏 `_sidebar.md`(有关示例,请参阅[本文档的侧边栏](https://github.com/docsifyjs/docsify/blob/main/docs/_sidebar.md)):

Expand Down Expand Up @@ -79,7 +79,7 @@ docs/zh-cn/guide.md => http://domain.com/#/zh-cn/guide
└── running-services.md
```

## 嵌套侧边栏
## 嵌套侧边栏 :id=nested-sidebars

你可能希望侧边栏在导航后更新以反映当前目录。 这可以通过在每个文件夹中添加一个 `_sidebar.md` 文件来实现。

Expand All @@ -100,7 +100,7 @@ docs/zh-cn/guide.md => http://domain.com/#/zh-cn/guide

> [!IMPORTANT] 你可以在一个子目录中创建一个 `README.md` 文件来作为路由的默认网页。

## 用侧边栏中选定的条目名称作为页面标题
## 用侧边栏中选定的条目名称作为页面标题 :id=set-page-titles-from-sidebar-selection

页面的 `title` 标签是根据_选定的_侧边栏项目名称生成的。 为了更好地进行搜索引擎优化,你可以在文件名后指定一个字符串来自定义标题。

Expand All @@ -111,7 +111,7 @@ docs/zh-cn/guide.md => http://domain.com/#/zh-cn/guide
- [Guide](guide.md 'The greatest guide in the world')
```

## 目录
## 目录 :id=table-of-contents

创建 `_sidebar.md` 后,侧边栏内容将根据 markdown 文件中的标题自动生成。

Expand All @@ -129,7 +129,7 @@ docs/zh-cn/guide.md => http://domain.com/#/zh-cn/guide
<script src="//cdn.jsdelivr.net/npm/docsify@5/dist/docsify.min.js"></script>
```

## 忽略副标题
## 忽略副标题 :id=ignoring-subheaders

当设置了 `subMaxLevel` 时,默认情况下每个标题都会自动添加到目录中。 如果你想忽略特定的标题,可以给它添加 `<!-- {docsify-ignore} -->` 。

Expand Down
4 changes: 2 additions & 2 deletions cdn.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ Docsify 推荐 [jsDelivr](//cdn.jsdelivr.net) 为其首选的 CDN:
- https://unpkg.com/browse/docsify/
- https://www.bootcdn.cn/docsify/ (支持国内)

## 指定版本
## 指定版本 :id=specifying-versions

请注意以下 CDN URL 中的`@`版本锁定。 这样就可以指定最新的主版本、次版本、补丁或特定 [semver](https://semver.org) 版本号。

Expand All @@ -25,7 +25,7 @@ Docsify 推荐 [jsDelivr](//cdn.jsdelivr.net) 为其首选的 CDN:

从文件名中移除`.min`,可获取未压缩的资源。

## 最新主要版本
## 最新主要版本 :id=latest-major-version

指定最新的主要版本允许你的网站在发布时接收所有非破坏性的增强("次级"更新)和错误修复("补丁"更新)。 对于那些倾向于零维护又可以随着新版本的发布更新其网站的风险最小化的人来说,这是一个好的选择。

Expand Down
29 changes: 29 additions & 0 deletions configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,35 @@ window.$docsify = {
};
```

## collapseSidebarGroups

- 类型:`Boolean`
- 默认:`false`

Initially collapses all root sidebar groups. Visitors can still expand and
collapse each group by selecting its title. Their choices are preserved while
navigating between pages.

```js
window.$docsify = {
collapseSidebarGroups: true,
};
```

## sidebarPosition

- 类型:`String`
- 默认:`'left'`

Controls which side of the page displays the sidebar. Set this to `'right'` to
place the sidebar and its toggle on the right.

```js
window.$docsify = {
sidebarPosition: 'right',
};
```

## homepage

- 类型:`String`
Expand Down
10 changes: 5 additions & 5 deletions cover.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# 封面
# 封面 :id=cover

通过设置 `coverpage` 为 **true** 来开启渲染封面功能。 参见 [coverpage configuration](zh-cn/configuration#coverpage)。

## 基本用法
## 基本用法 :id=basic-usage

设置 `coverpage` 为 **true**, 并创建 `_coverpage.md` :

Expand All @@ -29,7 +29,7 @@ window.$docsify = {
[Get Started](#docsify)
```

## 定制化
## 定制化 :id=customization

封面页可使用[主题属性](zh-cn/theme#theme-properties)进行自定义:

Expand Down Expand Up @@ -59,11 +59,11 @@ window.$docsify = {
![](_media/bg.png)
```

## 封面作为首页
## 封面作为首页 :id=coverpage-as-homepage

通常,封面页和主页同时出现。 当然,你也可以用[`onlyCover`](zh-cn/configuration#onlycover)选项分离封面。

## 多个封面
## 多个封面 :id=multiple-covers

如果你的文档网站是多语言的,或许你需要设置多个封面。

Expand Down
6 changes: 3 additions & 3 deletions custom-navbar.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 自定义导航栏
# 自定义导航栏 :id=custom-navbar

## HTML

Expand Down Expand Up @@ -55,7 +55,7 @@

`_navbar.md` 会从每一级目录加载。 如果当前目录中没有 `_navbar.md`,则会返回上一级目录。 例如,如果当前路径是 `/guide/quick-start`,则将从 `/guide/_navbar.md` 加载 `_navbar.md`。

## 嵌套
## 嵌套 :id=nesting

你可以通过缩进在某个父级下的项目来创建子列表。

Expand All @@ -82,7 +82,7 @@

![嵌套导航栏](../_images/zh-cn/nested-navbar.png "嵌套导航栏")

## 整合自定义导航栏与 emoji 插件
## 整合自定义导航栏与 emoji 插件 :id=combining-custom-navbars-with-the-emoji-plugin

如果你使用 [emoji 插件](zh-cn/plugins#emoji):

Expand Down
8 changes: 4 additions & 4 deletions deploy.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 部署
# 部署 :id=deploy

与 [GitBook](https://www.gitbook.com) 类似,你可以将文件部署到 GitHub Pages、GitLab Pages或 VPS 上。

Expand Down Expand Up @@ -39,7 +39,7 @@ pages:

> !IMPORTANT] 你可以用 `- cp -r docs/. public` 替换脚本,如果 `./docs` 是你的 docsify 子文件夹。

## Firebase 主机
## Firebase 主机 :id=firebase-hosting

> [!IMPORTANT] 你需要先使用谷歌账号登录 [Firebase 控制台](https://console.firebase.google.com),然后使用 `npm i -g firebase-tools` 命令安装 Firebase CLI 。

Expand Down Expand Up @@ -100,7 +100,7 @@ server {
6. 在**Publish directory**区域,如果你在**Base Directory**中添加了 `docs`,你会看到 Publish directory 中填充了 `docs/`
7. Netlify 很聪明,会在 `docs/` 文件夹中查找 `index.html` 文件。

### HTML5 路由
### HTML5 路由 :id=html5-router

当使用 HTML5 路由时,你需要设置一条将所有请求重定向到你的 `index.html` 的重定向规则。 当你使用Netlify时这相当简单。 只需在 docs 目录中创建一个名为 `_redirects` 的文件,并将此代码段添加到文件中,就可以了:

Expand Down Expand Up @@ -210,7 +210,7 @@ frontend:
docker run -itp 3000:3000 --name=docsify -v $(pwd):/docs docsify/demo
```

## Kinsta 静态网站托管
## Kinsta 静态网站托管 :id=kinsta-static-site-hosting

你可以将 **Docsify** 作为静态网站部署到 [Kinsta](https://kinsta.com/static-site-hosting/) 上。

Expand Down
20 changes: 10 additions & 10 deletions embed-files.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 文件嵌入
# 文件嵌入 :id=embed-files

从 Docsify 4.6 起可以嵌入任何类型的文件。

Expand All @@ -20,7 +20,7 @@

外部链接也可以使用 - 只是替换目标。 如果你想要使用 gist URL,请查看[嵌入 gist](#embed-a-gist) 部分。

## 嵌入文件类型
## 嵌入文件类型 :id=embedded-file-type

目前,文件扩展名自动识别并以不同方式嵌入。

Expand All @@ -42,7 +42,7 @@

[filename](../_media/example.md ":include :type=code")

## Markdown 与 YAML 元数据结合
## Markdown 与 YAML 元数据结合 :id=markdown-with-yaml-front-matter

Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元数据。 [front-matter.js](https://www.npmjs.com/package/front-matter) 包便于从文档中提取元数据(front matter)。

Expand All @@ -60,7 +60,7 @@ Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元

[filename](../_media/example-with-yaml.md ":include")

## 嵌入代码片段
## 嵌入代码片段 :id=embedded-code-fragments

有时你不想嵌入整个文件。 也许是因为你只需要几行,但你想在 CI 中编译和测试该文件。

Expand All @@ -87,7 +87,7 @@ Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元

[filename](../_media/example.js ":include :type=code :fragment=demo")

## 标签属性
## 标签属性 :id=tag-attribute

如果你嵌入文件是一个 `iframe`、`audio` 或者 `video`,你可以给这些标签设置属性。

Expand All @@ -105,7 +105,7 @@ Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元

你看到它了吗? 你只需要直接写入属性。 每个标签有哪些属性建议你查看 [MDN 文档](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe)。

## 代码块高亮
## 代码块高亮 :id=the-code-block-highlight

嵌入任何类型的源代码文件,你可以指定高亮语言或自动标识。

Expand All @@ -119,13 +119,13 @@ Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元

> [!TIP] 如何设置高亮? 你可以查看[此处](zh-cn/language-highlight.md)。

## 嵌入 Gist
## 嵌入 Gist :id=embed-a-gist

你可以将 Gist 作为 Markdown 内容或代码块嵌入。这是基于[嵌入文件](#embed-files)部分开头的方法,不过是嵌入一个原始的 Gist URL。

> [!TIP] **无需**更改插件或应用程序配置即可运行。 事实上,即使你使用插件或修改配置来允许加载外部脚本,从 Gist 复制的 Embed `script` 标签也_无法_加载。

### 确定 Gist 的元数据
### 确定 Gist 的元数据 :id=identify-the-gists-metadata

从查看 `gist.github.com` 上的 Gist 开始。 为了本指南的目的,我们使用这个 Gist:

Expand All @@ -152,7 +152,7 @@ Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元

继续下面的一个部分,将 Gist 嵌入到 Docsify 页面上。

### 渲染 Gist 中的 Markdown 内容
### 渲染 Gist 中的 Markdown 内容 :id=render-markdown-content-from-a-gist

这是将内容**无缝**嵌入到你的文档中的好方法,而不需要将别人引到外部链接。 这种方法非常适合在多个版本库的文档站点上重复使用安装说明要点。 这个方法与你的帐户或其他用户拥有的 Gist 同样有效。

Expand All @@ -174,7 +174,7 @@ Front Matter 通常在 Jekyl 等博客系统中使用,用于定义文档的元

`LABEL` 可以是你想要的任何文本。 如果链接被破坏,它可以作为一个 _fallback_ 信息。所以在这里重复文件名是很有用的,万一你需要修复一个破坏的链接。 它还可以使嵌入的元素一目了然。

### 渲染 Gist 中的代码块
### 渲染 Gist 中的代码块 :id=render-a-codeblock-from-a-gist

格式与上一节相同,但在 alt 文本中添加了 `:type=code`。 与[嵌入文件类型](#embedded-file-type)部分一样,语法高亮将从扩展名(如 `.js` 或 `.py`)中**推断**,所以你可以将 `type` 设置为 `code`。

Expand Down
18 changes: 9 additions & 9 deletions helpers.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# 文档助手
# 文档助手 :id=doc-helper

docsify 扩展了一些 Markdown 语法,可以让文档更易读。

> 注意:对于特殊的代码语法,最好将其放在代码的反斜线内,以避免与配置或表情符号发生冲突。

## 标注
## 标注 :id=callouts

Docsify 支持 [GitHub 风格](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#alerts) 标注(也称为“警告”或“警报”)。

Expand Down Expand Up @@ -70,7 +70,7 @@ Docsify 支持 [GitHub 风格](https://docs.github.com/en/get-started/writing-on
?> Legacy **Tip** callouts are deprecated.
```

## 链接属性
## 链接属性 :id=link-attributes

### disabled

Expand Down Expand Up @@ -109,7 +109,7 @@ Docsify 支持 [GitHub 风格](https://docs.github.com/en/get-started/writing-on
[link](/demo2 ':target=_self')
```

## 任务清单
## 任务清单 :id=task-lists

```markdown
- [ ] foo
Expand All @@ -127,9 +127,9 @@ Docsify 支持 [GitHub 风格](https://docs.github.com/en/get-started/writing-on
- [ ] bim
- [ ] lim

## 图片
## 图片 :id=images

### 类名
### 类名 :id=class-names

```markdown
![logo](https://docsify.js.org/_media/icon.svg ':class=someCssClass')
Expand All @@ -145,7 +145,7 @@ Docsify 支持 [GitHub 风格](https://docs.github.com/en/get-started/writing-on
![logo](https://docsify.js.org/_media/icon.svg ':id=someCssId')
```

### 大小
### 大小 :id=sizes

```markdown
![logo](https://docsify.js.org/_media/icon.svg ':size=WIDTHxHEIGHT')
Expand All @@ -161,13 +161,13 @@ Docsify 支持 [GitHub 风格](https://docs.github.com/en/get-started/writing-on
![logo](https://docsify.js.org/_media/icon.svg ":size=100")
![logo](https://docsify.js.org/_media/icon.svg ":size=10%")

## 设置标题的 id 属性
## 设置标题的 id 属性 :id=heading-ids

```markdown
### 你好,世界! :id=hello-world
```

## HTML 标签中的 Markdown
## HTML 标签中的 Markdown :id=markdown--html

你需要在 html 和 markdown 内容之间插入空格。
这对于在 details 元素中呈现 markdown 内容非常有用。
Expand Down
4 changes: 2 additions & 2 deletions language-highlight.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 代码高亮
# 代码高亮 :id=language-highlighting

## Prism

Expand Down Expand Up @@ -129,7 +129,7 @@ Docsify 的官方[主题](zh-cn/themes)与 Prism 语法高亮主题兼容。
</style>
```

## 动态内容
## 动态内容 :id=dynamic-content

可以使用 Prism 的 [`highlightElement()`](https://prismjs.com/docs/Prism.html#.highlightElement) 方法高亮显示动态生成的代码块:

Expand Down
Loading