From fa84309926973d9641a5b5b810f9e8dc3addbdd2 Mon Sep 17 00:00:00 2001 From: crossoverJie Date: Tue, 6 Nov 2018 07:51:22 +0800 Subject: [PATCH 01/33] Update cover.md (#5) --- cover.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cover.md b/cover.md index 1577cfa..6bab8fe 100644 --- a/cover.md +++ b/cover.md @@ -17,7 +17,7 @@ _index.html_ ``` -_\_coverpage.md_ +`_coverpage.md` ```markdown ![logo](_media/icon.svg) @@ -40,7 +40,7 @@ _\_coverpage.md_ 目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。 -_\_coverpage.md_ +`_coverpage.md` ```markdown # docsify From 7c8e523de3dd40f952ffedbaf89d3ee402f88686 Mon Sep 17 00:00:00 2001 From: Andy Chen Date: Mon, 7 Jan 2019 11:55:06 +0800 Subject: [PATCH 02/33] Translate some English content to Chinese (#6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README.md * Update README.md * Translate some untranslated part of this doc * Translate the untranslated part of this doc * Translate the untranslated part of this doc * 翻译未翻译内容 * Update helpers.md --- README.md | 4 ++-- configuration.md | 42 +++++++++++++++++++++--------------------- deploy.md | 8 ++++---- helpers.md | 2 +- plugins.md | 18 ++++++++---------- themes.md | 4 ++-- 6 files changed, 38 insertions(+), 40 deletions(-) diff --git a/README.md b/README.md index 1882d81..3b1b5cd 100644 --- a/README.md +++ b/README.md @@ -29,6 +29,6 @@ docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo 如果你觉得 docsify 对你有帮助,或者想对我微小的工作一点资瓷,欢迎给我[捐赠](https://github.com/QingWei-Li/donate)。 -## Community +## 社区 -Users and development team are in the [Gitter](https://gitter.im/docsifyjs/Lobby). +在[Gitter](https://gitter.im/docsifyjs/Lobby)的社区里可以找到docsify的用户和开发者团队。 diff --git a/configuration.md b/configuration.md index b92e159..27d76bc 100644 --- a/configuration.md +++ b/configuration.md @@ -177,9 +177,9 @@ window.$docsify = { ## logo -- Type: `String` +- 类型: `String` -Website logo as it appears in the sidebar, you can resize by CSS. +在侧边栏中出现的网站图标,你可以使用`CSS`来更改大小 ```js window.$docsify = { @@ -311,7 +311,7 @@ window.$docsify = { ## noEmoji -- type: `Boolean` +- 类型: `Boolean` 禁用 emoji 解析。 @@ -323,7 +323,7 @@ window.$docsify = { ## mergeNavbar -- type: `Boolean` +- 类型: `Boolean` 小屏设备下合并导航栏到侧边栏。 @@ -335,7 +335,7 @@ window.$docsify = { ## formatUpdated -- type: `String|Function` +- 类型: `String|Function` 我们可以显示文档更新日期通过 **{docsify-updated}** 变量. 并且格式化日期通过 `formatUpdated`。参考 https://github.com/lukeed/tinydate#patterns @@ -353,8 +353,8 @@ window.$docsify = { ## externalLinkTarget -- type: `String` -- default: `_blank` +- 类型: `String` +- 默认: `_blank` 当前默认为 \_blank, 配置一下就可以: @@ -366,8 +366,8 @@ window.$docsify = { ## routerMode -- type: `String` -- default: `hash` +- 类型: `String` +- 默认: `hash` ```js window.$docsify = { @@ -389,7 +389,7 @@ window.$docsify = { ## requestHeaders -- type: `Object` +- 类型: `Object` 设置请求资源的请求头。 @@ -403,7 +403,7 @@ window.$docsify = { ## ext -- type: `String` +- 类型: `String` 资源的文件扩展名。 @@ -415,15 +415,15 @@ window.$docsify = { ## fallbackLanguages -- type: `Array` +- 类型: `Array` -List of languages that will fallback to the default language when a page is request and didn't exists for the given local. +一个语言列表。在浏览这个列表中的语言的翻译文档时都会在请求到一个对应语言的翻译文档不存在时显示默认语言的同名文档 Example: -- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed -- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed -- then display 404 page. +- 尝试访问`/de/overview`,如果存在则显示 +- 如果不存在则尝试`/overview`(取决于默认语言),如果存在即显示 +- 如果也不存在,显示404页面 ```js window.$docsify = { @@ -433,9 +433,9 @@ window.$docsify = { ## notFoundPage -- type: `Boolean` | `String` | `Object` +- 类型: `Boolean` | `String` | `Object` -Load the `_404.md` file: +在找不到指定页面时加载`_404.md`: ```js window.$docsify = { @@ -443,7 +443,7 @@ window.$docsify = { }; ``` -Load the customised path of the 404 page: +加载自定义404页面: ```js window.$docsify = { @@ -451,7 +451,7 @@ window.$docsify = { }; ``` -Load the right 404 page according to the localisation: +加载正确的本地化过的404页面: ```js window.$docsify = { @@ -462,4 +462,4 @@ window.$docsify = { }; ``` -> Note: The options with fallbackLanguages didn't work with the `notFoundPage` options. +> 注意: 配置过`fallbackLanguages`这个选项的页面与这个选项`notFoundPage`冲突。 diff --git a/deploy.md b/deploy.md index b80cf22..471c1e8 100644 --- a/deploy.md +++ b/deploy.md @@ -58,13 +58,13 @@ server { ## Netlify -1. Login to your [Netlify](https://www.netlify.com/) account. -2. In the [dashboard](https://app.netlify.com/) page, click **New site from Git**. -3. Choose a repository where you store your docs, leave the **Build Command** area blank, fill in the Publish directory area with the directory of your `index.html`, for example it should be docs if you populated it at `docs/index.html`. +1. 登陆你的[Netlify](https://www.netlify.com/)账号 +2. 在[dashboard](https://app.netlify.com/)页上点击 **New site from Git**. +3. 选择那个你用来存储文档的git仓库,将 **Build Command** 留空, 将 **Publish directory** 区域填入你的`index.html`所在的目录,例如:填入`docs`(如果你的`index.html`的相对路径是`docs/index.html`的话). ### HTML5 router -When using the HTML5 router, you need to set up redirect rules that redirect all requests to your `index.html`, it's pretty simple when you're using Netlify, populate a `\redirects` file in the docs directory and you're all set: +当使用HTML5路由时,你需要设置一条将所有请求重定向到你的`index.html`的重定向规则。当你使用Netlify时这相当简单,在你的**Publish Directory**下创建一个`\redirects`文件,写进以下内容,然后——:tada:就好了: ```sh /* /index.html 200 diff --git a/helpers.md b/helpers.md index 3e230a2..b52123e 100644 --- a/helpers.md +++ b/helpers.md @@ -71,7 +71,7 @@ docsify 扩展了一些 Markdown 语法,可以让文档更易读。 - [ ] bim - [ ] lim -## Image resizing +## 图片缩放 ```md ![logo](https://docsify.js.org/_media/icon.svg ':size=50x100') diff --git a/plugins.md b/plugins.md index 545dcd8..9fc7706 100644 --- a/plugins.md +++ b/plugins.md @@ -84,11 +84,9 @@ ## Demo code with instant preview and jsfiddle integration -With this plugin, sample code can be rendered on the page instantly, so that the readers can see the preview immediately. -When readers expand the demo box, the source code and description are shown there. if they click the button `Try in Jsfiddle`, -`jsfiddle.net` will be open with the code of this sample, which allow readers to revise the code and try on their own. +使用这个插件,示例代码可以在页面上立刻渲染,这样就可以立刻看到效果。当示例框被展开时,源码和描述会被显示出来,如果他们点击`Try in Jsfiddle`这个按钮,将会在`jsfiddle.net`中打开一个包含这些示例代码的项目,这样就可以修改源码和测试了。 -[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/) and [React](https://njleonzhang.github.io/docsify-demo-box-react/) are both supported. +docsify同时支持[Vue](https://njleonzhang.github.io/docsify-demo-box-vue/)和[React](https://njleonzhang.github.io/docsify-demo-box-react/)版本的插件。 ## 图片缩放 - Zoom image @@ -108,9 +106,9 @@ Medium's 风格的图片缩放插件. 基于 [medium-zoom](https://github.com/fr 在每一页上添加 `Edit on github` 按钮. 由第三方库提供, 查看 [document](https://github.com/njleonzhang/docsify-edit-on-github) -## Copy to Clipboard +## 复制到剪贴板 -Add a simple `Click to copy` button to all preformatted code blocks to effortlessly allow users to copy example code from your docs. Provided by [@jperasmus](https://github.com/jperasmus) +在所有的代码块上添加一个简单的`Click to copy`按钮来允许用户从你的文档中轻易地复制代码。由[@jperasmus](https://github.com/jperasmus)提供。 ```html @@ -120,7 +118,7 @@ See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) ## Disqus -Disqus comments. https://disqus.com/ +Disqus评论系统支持。 https://disqus.com/ ```html ``` -## Pagination +## [Pagination](https://github.com/imyelo/docsify-pagination#readme) -Pagination for docsify. By [@imyelo](https://github.com/imyelo) +docsify的分页导航插件,由[@imyelo](https://github.com/imyelo)提供。 ```html diff --git a/themes.md b/themes.md index a7a56f6..ccfcd48 100644 --- a/themes.md +++ b/themes.md @@ -56,6 +56,6 @@ -## Other themes +## 其他主题 -- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) A delightfully simple theme system for docsify. +- [docsify-themeable](https://jhildenbiddle.github.io/docsify-themeable/#/) 一个用于docsify的,简单到令人愉悦的主题系统. From b142bf7b81f18c24a23a3ea604022ee70abb9cad Mon Sep 17 00:00:00 2001 From: Andy Chen Date: Tue, 8 Jan 2019 17:37:45 +0800 Subject: [PATCH 03/33] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E7=BF=BB=E8=AF=91=20(#?= =?UTF-8?q?7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update README.md * Update README.md * Translate some untranslated part of this doc * Translate the untranslated part of this doc * Translate the untranslated part of this doc * 翻译未翻译内容 * Update helpers.md * 翻译未翻译部分,添加到docsify-pagination的链接 --- plugins.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins.md b/plugins.md index 9fc7706..2ab688f 100644 --- a/plugins.md +++ b/plugins.md @@ -114,7 +114,7 @@ Medium's 风格的图片缩放插件. 基于 [medium-zoom](https://github.com/fr ``` -See [here](https://github.com/jperasmus/docsify-copy-code/blob/master/README.md) for more details. +从[这里](https://github.com/jperasmus/docsify-copy-code#readme)获取更多信息。 ## Disqus @@ -151,7 +151,7 @@ Disqus评论系统支持。 https://disqus.com/ ``` -## [Pagination](https://github.com/imyelo/docsify-pagination#readme) +## Pagination docsify的分页导航插件,由[@imyelo](https://github.com/imyelo)提供。 @@ -160,6 +160,8 @@ docsify的分页导航插件,由[@imyelo](https://github.com/imyelo)提供。 ``` +从[这里](https://github.com/imyelo/docsify-pagination#readme)获取更多信息。 + ## Code Fund 帮你快速接入[Code Fund](https://codesponsor.io/)的[插件](https://github.com/njleonzhang/docsify-plugin-codefund), 由[@njleonzhang](https://github.com/njleonzhang)提供。 From 5f30896c47f60da7f10b9022585bf66ca5999b29 Mon Sep 17 00:00:00 2001 From: Andy Chen Date: Fri, 5 Apr 2019 10:28:59 +0800 Subject: [PATCH 04/33] =?UTF-8?q?=E5=A2=9E=E5=8A=A0theme.md=E4=B8=ADdolphi?= =?UTF-8?q?n=E4=B8=BB=E9=A2=98=E9=93=BE=E6=8E=A5=20(#8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update themes.md * Update themes.md --- themes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/themes.md b/themes.md index ccfcd48..4fbc2c9 100644 --- a/themes.md +++ b/themes.md @@ -7,6 +7,7 @@ + ``` !> CSS 的压缩文件位于 `/lib/themes/` @@ -16,6 +17,7 @@ + ``` 如果你有其他想法或者想开发别的主题,欢迎提 [PR](https://github.com/docsifyjs/docsify/pulls)。 @@ -28,6 +30,7 @@ buble.css dark.css pure.css + dolphin.css From dd0f75ff34cd9236cc1c364d677283b69e3f9c6d Mon Sep 17 00:00:00 2001 From: mengxiaon <38374140+mengxiaon@users.noreply.github.com> Date: Sun, 7 Jul 2019 14:48:27 +0800 Subject: [PATCH 05/33] Update configuration.md (#10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修改语言不通顺的地方 --- configuration.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configuration.md b/configuration.md index 27d76bc..e199806 100644 --- a/configuration.md +++ b/configuration.md @@ -337,7 +337,7 @@ window.$docsify = { - 类型: `String|Function` -我们可以显示文档更新日期通过 **{docsify-updated}** 变量. 并且格式化日期通过 `formatUpdated`。参考 https://github.com/lukeed/tinydate#patterns +我们可以通过 **{docsify-updated}** 变量显示文档更新日期. 并且通过 `formatUpdated`配置日期格式。参考 https://github.com/lukeed/tinydate#patterns ```js window.$docsify = { @@ -417,7 +417,7 @@ window.$docsify = { - 类型: `Array` -一个语言列表。在浏览这个列表中的语言的翻译文档时都会在请求到一个对应语言的翻译文档不存在时显示默认语言的同名文档 +一个语言列表。在浏览这个列表中的语言的翻译文档时都会在请求到一个对应语言的翻译文档,不存在时显示默认语言的同名文档 Example: From 388ca936655dd54c7ed28bccc8a4155482e50bce Mon Sep 17 00:00:00 2001 From: King Date: Mon, 15 Jul 2019 10:47:21 +0800 Subject: [PATCH 06/33] fix: misleading document of sidebar (#11) fix issues: https://github.com/docsifyjs/docsify/issues/883 --- more-pages.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/more-pages.md b/more-pages.md index ea0a8c0..7c4b38d 100644 --- a/more-pages.md +++ b/more-pages.md @@ -24,7 +24,7 @@ docs/zh-cn/guide.md => http://domain.com/zh-cn/guide ## 定制侧边栏 -默认情况下,侧边栏会根据当前文档的标题生成目录。也可以设置文档链接,通过 Markdown 文件生成,效果如当前的文档的侧边栏。 +为了获得侧边栏,您需要创建自己的_sidebar.md,你也可以自定义加载的文件名。默认情况下侧边栏会通过 Markdown 文件自动生成,效果如当前的文档的侧边栏。 首先配置 `loadSidebar` 选项,具体配置规则见[配置项#loadSidebar](zh-cn/configuration.md#loadsidebar)。 From 05c14b65e3515588edc4d72b747c654ad8f150bb Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Wed, 5 Feb 2020 20:52:47 +0800 Subject: [PATCH 07/33] Update write-a-plugin.md (#13) --- write-a-plugin.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/write-a-plugin.md b/write-a-plugin.md index c83b107..dfc23d7 100644 --- a/write-a-plugin.md +++ b/write-a-plugin.md @@ -12,6 +12,10 @@ window.$docsify = { // 初始化时调用,只调用一次,没有参数。 }) + hook.mounted(function() { + // 初始化完成后调用,只调用一次,没有参数。 + }) + hook.beforeEach(function(content) { // 每次开始解析 Markdown 内容时调用 // ... @@ -30,12 +34,8 @@ window.$docsify = { // ... }) - hook.mounted(function() { - // 初始化完成后调用 ,只调用一次,没有参数。 - }) - hook.ready(function() { - // 初始化并第一次加完成数据后调用,没有参数。 + // 初始化并第一次加载完成数据后调用,没有参数。 }) } ] From de45da4c2d7e947581fcd99bb7191ac65803e16d Mon Sep 17 00:00:00 2001 From: Su Yiheng <34745814+827652549@users.noreply.github.com> Date: Tue, 7 Apr 2020 12:21:48 +0800 Subject: [PATCH 08/33] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=AD=97=E6=95=B0?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E6=8F=92=E4=BB=B6=20(#15)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 这是一款为docsify提供文字统计的插件 --- plugins.md | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plugins.md b/plugins.md index 2ab688f..4f55610 100644 --- a/plugins.md +++ b/plugins.md @@ -162,6 +162,32 @@ docsify的分页导航插件,由[@imyelo](https://github.com/imyelo)提供。 从[这里](https://github.com/imyelo/docsify-pagination#readme)获取更多信息。 +## 字数统计 + +这是一款为docsify提供文字统计的插件. [@827652549](https://github.com/827652549)提供 + +它提供了统计中文汉字和英文单词的功能,并且排除了一些markdown语法的特殊字符例如*、-等 + +**Add JS** +```html + +``` + +**Add settings** +```js +window.$docsify = { + count:{ + countable:true, + fontsize:'0.9em', + color:'rgb(90,90,90)', + language:'chinese' + } +} +``` + +check [document](https://github.com/827652549/docsify-count) + + ## Code Fund 帮你快速接入[Code Fund](https://codesponsor.io/)的[插件](https://github.com/njleonzhang/docsify-plugin-codefund), 由[@njleonzhang](https://github.com/njleonzhang)提供。 From 29a57ee553c7cf338395c23279d86152dba6baaa Mon Sep 17 00:00:00 2001 From: TianYongwei Date: Tue, 7 Apr 2020 12:21:56 +0800 Subject: [PATCH 09/33] =?UTF-8?q?=E9=94=99=E5=88=AB=E5=AD=97=EF=BC=9A?= =?UTF-8?q?=E6=9C=80=E5=A4=A7=20[=E7=A8=8B]=20=E7=BA=A7=20-->=20=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=20[=E5=B1=82]=20=E7=BA=A7=20(#12)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如题 --- plugins.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins.md b/plugins.md index 4f55610..b0ec7df 100644 --- a/plugins.md +++ b/plugins.md @@ -36,7 +36,7 @@ '/': 'No Results' }, - // 搜索标题的最大程级, 1 - 6 + // 搜索标题的最大层级, 1 - 6 depth: 2 } } From 4bbe985337650ebcacc20207ce63b6b2c25d3ff9 Mon Sep 17 00:00:00 2001 From: ibbcall <49087251+ibbcall@users.noreply.github.com> Date: Tue, 7 Apr 2020 12:22:06 +0800 Subject: [PATCH 10/33] Update custom-navbar.md (#9) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - “基础”修正为“入门”,这样与文字下图的展示一致。 - 去掉了一行无用代码。 --- custom-navbar.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/custom-navbar.md b/custom-navbar.md index 5bb5156..04f67c6 100644 --- a/custom-navbar.md +++ b/custom-navbar.md @@ -26,7 +26,6 @@ _index.html_ loadNavbar: true } - ``` _\_navbar.md_ @@ -45,7 +44,7 @@ _\_navbar.md_ _navbar.md_ ```markdown -* 基础 +* 入门 * [快速开始](zh-cn/quickstart.md) * [多页文档](zh-cn/more-pages.md) * [定制导航栏](zh-cn/custom-navbar.md) From ba898769fa4d9ef571621b4eff79b111d2d0268b Mon Sep 17 00:00:00 2001 From: Luffy <52o@qq52o.cn> Date: Thu, 23 Apr 2020 17:56:14 +0800 Subject: [PATCH 11/33] Update cover.md (#18) --- cover.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/cover.md b/cover.md index 6bab8fe..1138865 100644 --- a/cover.md +++ b/cover.md @@ -34,8 +34,6 @@ _index.html_ [Get Started](#quick-start) ``` -!> 一份文档只会在根目录下加载封面,其他页面或者二级目录下都不会加载。 - ## 自定义背景 目前的背景是随机生成的渐变色,我们自定义背景色或者背景图。在文档末尾用添加图片的 Markdown 语法设置背景。 @@ -87,7 +85,7 @@ window.$docsify = { }; ``` -或者具体指名文件名 +或者指定具体的文件名 ```js window.$docsify = { From e6a603808cc3214ebe3c6d458aacbc7ad43c4e91 Mon Sep 17 00:00:00 2001 From: Yan Chen Date: Sun, 26 Apr 2020 13:54:44 +0800 Subject: [PATCH 12/33] Update the ALL chinese doc translation to v4.11.3 . (#19) * Update some translate to 4.11.3 version. * Update more docs to chinese. * update the all document to v4.11.3 chinese. * Update README.md * Update cdn.md * Update configuration.md * Update cover.md * Update custom-navbar.md * Update deploy.md * Update deploy.md * Update embed-files.md * Update plugins.md * PR modify request modified. * delete an extra line. * delete an extra line. * Update deploy.md Co-authored-by: Luffy <52o@qq52o.cn> --- README.md | 6 +- cdn.md | 33 ++++--- configuration.md | 210 +++++++++++++++++++++++++++++++++--------- cover.md | 24 +++-- custom-navbar.md | 48 ++++++++-- deploy.md | 72 ++++++++++++++- embed-files.md | 17 +++- helpers.md | 69 +++++++++++++- language-highlight.md | 6 +- markdown.md | 3 +- more-pages.md | 46 ++++++--- plugins.md | 64 +++++++------ pwa.md | 2 +- quickstart.md | 12 ++- ssr.md | 90 +++++++++++------- themes.md | 24 ++--- vue.md | 53 +++++------ write-a-plugin.md | 123 ++++++++++++++----------- 18 files changed, 648 insertions(+), 254 deletions(-) diff --git a/README.md b/README.md index 3b1b5cd..15ffcb6 100644 --- a/README.md +++ b/README.md @@ -13,13 +13,13 @@ docsify 是一个动态生成文档网站的工具。不同于 GitBook、Hexo ## 特性 - 无需构建,写完文档直接发布 -- 容易使用并且轻量 (~19kB gzipped) +- 容易使用并且轻量 (压缩后 ~21kB) - 智能的全文搜索 - 提供多套主题 - 丰富的 API - 支持 Emoji -- 兼容 IE10+ -- 支持 SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo)) +- 兼容 IE11 +- 支持服务端渲染 SSR ([示例](https://github.com/docsifyjs/docsify-ssr-demo)) ## 例子 diff --git a/cdn.md b/cdn.md index 5b98d68..e47a99d 100644 --- a/cdn.md +++ b/cdn.md @@ -1,45 +1,53 @@ # CDN -推荐使用 [unpkg](//unpkg.com) —— 能及时获取到最新版。 +推荐使用 [jsDelivr](//cdn.jsdelivr.net),能及时获取到最新版。你也可以在[cdn.jsdelivr.net/npm/docsify/](cdn.jsdelivr.net/npm/docsify/)中浏览npm包的源代码。 ## 获取最新版本 -根据 UNPKG 的规则,不指定特定版本号时将引入最新版。 +不指定特定版本号时将引入最新版。 ```html - + - + ``` +也可以使用 [压缩版文件](#compressed-file). + ## 获取指定版本 -如果担心频繁地版本更新又可能引入未知 Bug,我们也可以使用具体的版本。规则是 `//unpkg.com/docsify@VERSION/` +如果担心频繁地版本更新又可能引入未知 Bug,我们也可以使用具体的版本。规则是 `//cdn.jsdelivr.net/npm/docsify@VERSION/` ```html - + - + ``` !> 指定 *VERSION* 为 `latest` 可以强制每次都请求最新版本。 ## 压缩版 -CSS 的压缩文件位于 `/lib/themes/` 目录下 +CSS 的压缩文件位于 `/lib/themes/` 目录下,JS 的压缩文件是原有文件路径的基础上加 `.min` 后缀。 ```html - -``` + + -JS 的压缩文件是原有文件路径的基础上加 `.min`后缀 + + +``` ```html - + + + + + ``` ## 其他 CDN @@ -47,3 +55,4 @@ JS 的压缩文件是原有文件路径的基础上加 `.min`后缀 - http://www.bootcdn.cn/docsify (支持国内) - https://cdn.jsdelivr.net/npm/docsify/ (国内外都支持) - https://cdnjs.com/libraries/docsify + diff --git a/configuration.md b/configuration.md index e199806..3aff8ae 100644 --- a/configuration.md +++ b/configuration.md @@ -7,8 +7,8 @@ window.$docsify = { repo: 'docsifyjs/docsify', maxLevel: 3, - coverpage: true - } + coverpage: true, + }; ``` @@ -21,7 +21,7 @@ docsify 初始化的挂载元素,可以是一个 CSS 选择器,默认为 `#a ```js window.$docsify = { - el: '#app' + el: '#app', }; ``` @@ -36,7 +36,7 @@ window.$docsify = { window.$docsify = { repo: 'docsifyjs/docsify', // or - repo: 'https://github.com/docsifyjs/docsify/' + repo: 'https://github.com/docsifyjs/docsify/', }; ``` @@ -49,7 +49,7 @@ window.$docsify = { ```js window.$docsify = { - maxLevel: 4 + maxLevel: 4, }; ``` @@ -66,7 +66,7 @@ window.$docsify = { loadNavbar: true, // 加载 nav.md - loadNavbar: 'nav.md' + loadNavbar: 'nav.md', }; ``` @@ -83,7 +83,20 @@ window.$docsify = { loadSidebar: true, // 加载 summary.md - loadSidebar: 'summary.md' + loadSidebar: 'summary.md', +}; +``` + +## hideSidebar + +- 类型 : `Boolean` +- 默认值: `true` + +这个选项用来完全隐藏侧边栏,侧边栏的任何内容都不会被渲染。 + +```js +window.$docsify = { + hideSidebar: true, }; ``` @@ -96,7 +109,7 @@ window.$docsify = { ```js window.$docsify = { - subMaxLevel: 2 + subMaxLevel: 2, }; ``` @@ -109,7 +122,7 @@ window.$docsify = { ```js window.$docsify = { - auto2top: true + auto2top: true, }; ``` @@ -127,7 +140,7 @@ window.$docsify = { // 文档和仓库根目录下的 README.md 内容一致 homepage: - 'https://raw.githubusercontent.com/docsifyjs/docsify/master/README.md' + 'https://raw.githubusercontent.com/docsifyjs/docsify/master/README.md', }; ``` @@ -144,9 +157,49 @@ window.$docsify = { // 直接渲染其他域名的文档 basePath: 'https://docsify.js.org/', - // 甚至直接渲染其他仓库 readme + // 甚至直接渲染其他仓库 basePath: - 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/' + 'https://raw.githubusercontent.com/ryanmcdermott/clean-code-javascript/master/', +}; +``` + +## relativePath + +- 类型: `Boolean` +- 默认值: `false` + +如果该选项设为 **true** ,那么链接会使用相对路径。 + +例如,像这样的目录结构: + +```text +. +└── docs + ├── README.md + ├── guide.md + └── zh-cn + ├── README.md + ├── guide.md + └── config + └── example.md +``` + +如果 **启用** 了相对路径,当前链接是 `http://domain.com/zh-cn/README` ,对应的链接会解析为: + +```text +guide.md => http://domain.com/zh-cn/guide +config/example.md => http://domain.com/zh-cn/config/example +../README.md => http://domain.com/README +/README.md => http://domain.com/README +``` + +```js +window.$docsify = { + // 启用相对路径 + relativePath: true, + + // 禁用相对路径(默认值) + relativePath: false, }; ``` @@ -164,14 +217,14 @@ window.$docsify = { // 自定义文件名 coverpage: 'cover.md', - // mutiple covers + // 多个封面页 coverpage: ['/', '/zh-cn/'], - // mutiple covers and custom file name + // 多个封面页,并指定文件名 coverpage: { '/': 'cover.md', - '/zh-cn/': 'cover.md' - } + '/zh-cn/': 'cover.md', + }, }; ``` @@ -183,7 +236,7 @@ window.$docsify = { ```js window.$docsify = { - logo: '/_media/icon.svg' + logo: '/_media/icon.svg', }; ``` @@ -195,7 +248,15 @@ window.$docsify = { ```js window.$docsify = { - name: 'docsify' + name: 'docsify', +}; +``` + +name 项也可以包含自定义 HTML 代码来方便地定制。 + +```js +window.$docsify = { + name: 'docsify', }; ``` @@ -213,8 +274,8 @@ window.$docsify = { // 按照路由切换 nameLink: { '/zh-cn/': '/zh-cn/', - '/': '/' - } + '/': '/', + }, }; ``` @@ -232,15 +293,15 @@ window.$docsify = { renderer: { link: function() { // ... - } - } + }, + }, }, // function markdown: function(marked, renderer) { // ... return marked; - } + }, }; ``` @@ -269,8 +330,8 @@ window.$docsify = { '/zh-cn/changelog': '/changelog', '/changelog': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/CHANGELOG', - '/.*/_sidebar.md': '/_sidebar.md' // See #301 - } + '/.*/_sidebar.md': '/_sidebar.md', // See #301 + }, }; ``` @@ -283,7 +344,7 @@ window.$docsify = { ```js window.$docsify = { loadSidebar: true, - autoHeader: true + autoHeader: true, }; ``` @@ -295,7 +356,7 @@ window.$docsify = { ```js window.$docsify = { - executeScript: true + executeScript: true, }; ``` @@ -317,10 +378,12 @@ window.$docsify = { ```js window.$docsify = { - noEmoji: true + noEmoji: true, }; ``` +?> 如果该选项设为 `false` ,但是你不想解析一些特别的表情符,[参考这里](https://github.com/docsifyjs/docsify/issues/742#issuecomment-586313143) + ## mergeNavbar - 类型: `Boolean` @@ -329,7 +392,7 @@ window.$docsify = { ```js window.$docsify = { - mergeNavbar: true + mergeNavbar: true, }; ``` @@ -337,7 +400,7 @@ window.$docsify = { - 类型: `String|Function` -我们可以通过 **{docsify-updated}** 变量显示文档更新日期. 并且通过 `formatUpdated`配置日期格式。参考 https://github.com/lukeed/tinydate#patterns +我们可以通过 **{docsify-updated}** 变量显示文档更新日期. 并且通过 `formatUpdated`配置日期格式。参考 [https://github.com/lukeed/tinydate#patterns](https://github.com/lukeed/tinydate#patterns) ```js window.$docsify = { @@ -347,7 +410,7 @@ window.$docsify = { // ... return time; - } + }, }; ``` @@ -356,11 +419,37 @@ window.$docsify = { - 类型: `String` - 默认: `_blank` -当前默认为 \_blank, 配置一下就可以: +外部链接的打开方式。默认为 `_blank` (在新窗口或者标签页中打开) + +```js +window.$docsify = { + externalLinkTarget: '_self', // default: '_blank' +}; +``` + +## cornerExternalLinkTarget + +- 类型:`String` +- 默认值:`_blank` + +右上角链接的打开方式。默认为 `_blank` (在新窗口或者标签页中打开) ```js window.$docsify = { - externalLinkTarget: '_self' // default: '_blank' + cornerExternalLinkTarget: '_self', // default: '_blank' +}; +``` + +## externalLinkRel + +- 类型: `String` +- 默认值: `noopener` + +默认为 `noopener` (no opener) 可以防止新打开的外部页面(当 [externalLinkTarget](#externallinktarget) 设为 `_blank` 时)能够控制我们的页面,没有设为 `_blank` 的话就不需要设置这个选项了。 + +```js +window.$docsify = { + externalLinkRel: '', // default: 'noopener' }; ``` @@ -371,7 +460,7 @@ window.$docsify = { ```js window.$docsify = { - routerMode: 'history' // default: 'hash' + routerMode: 'history', // default: 'hash' }; ``` @@ -383,7 +472,19 @@ window.$docsify = { ```js window.$docsify = { - noCompileLinks: ['/foo', '/bar/.*'] + noCompileLinks: ['/foo', '/bar/.*'], +}; +``` + +## onlyCover + +- 类型: `Boolean` + +只在访问主页时加载封面。 + +```js +window.$docsify = { + onlyCover: false, }; ``` @@ -396,8 +497,18 @@ window.$docsify = { ```js window.$docsify = { requestHeaders: { - 'x-token': 'xxx' - } + 'x-token': 'xxx', + }, +}; +``` + +例如设置缓存 + +```js +window.$docsify = { + requestHeaders: { + 'cache-control': 'max-age=600', + }, }; ``` @@ -409,7 +520,7 @@ window.$docsify = { ```js window.$docsify = { - ext: '.md' + ext: '.md', }; ``` @@ -427,7 +538,7 @@ Example: ```js window.$docsify = { - fallbackLanguages: ['fr', 'de'] + fallbackLanguages: ['fr', 'de'], }; ``` @@ -439,7 +550,7 @@ window.$docsify = { ```js window.$docsify = { - notFoundPage: true + notFoundPage: true, }; ``` @@ -447,7 +558,7 @@ window.$docsify = { ```js window.$docsify = { - notFoundPage: 'my404.md' + notFoundPage: 'my404.md', }; ``` @@ -457,9 +568,22 @@ window.$docsify = { window.$docsify = { notFoundPage: { '/': '_404.md', - '/de': 'de/_404.md' - } + '/de': 'de/_404.md', + }, }; ``` > 注意: 配置过`fallbackLanguages`这个选项的页面与这个选项`notFoundPage`冲突。 + +## topMargin + +- 类型: `Number` +- 默认值: `0` + +让你的内容页在滚动到指定的锚点时,距离页面顶部有一定空间。当你使用 `固定页头` 布局时这个选项很有用,可以让你的锚点对齐标题栏。 + +```js +window.$docsify = { + topMargin: 90, // default: 0 +}; +``` diff --git a/cover.md b/cover.md index 1138865..cf4927a 100644 --- a/cover.md +++ b/cover.md @@ -9,29 +9,31 @@ _index.html_ ```html + + - + ``` -`_coverpage.md` - ```markdown + + ![logo](_media/icon.svg) -# docsify +# docsify 3.5 -> A magical documentation site generator. +> 一个神奇的文档网站生成器。 -* Simple and lightweight (~12kb gzipped) -* Multiple themes -* Not build static html files +- 简单、轻便 (压缩后 ~21kB) +- 无需生成 html 文件 +- 众多主题 [GitHub](https://github.com/docsifyjs/docsify/) -[Get Started](#quick-start) +[Get Started](#docsify) ``` ## 自定义背景 @@ -41,7 +43,9 @@ _index.html_ `_coverpage.md` ```markdown -# docsify + + +# docsify 3.5 [GitHub](https://github.com/docsifyjs/docsify/) [Get Started](#quick-start) diff --git a/custom-navbar.md b/custom-navbar.md index 04f67c6..44cef8e 100644 --- a/custom-navbar.md +++ b/custom-navbar.md @@ -1,10 +1,13 @@ # 自定义导航栏 -我们可以直接在 HTML 里定义导航栏,要注意链接要以 `#/` 开头。 +## HTML +如果你需要定制导航栏,可以用 HTML 创建一个导航栏。 -_index.html_ +!> 注意:文档的链接都要以 `#/` 开头。 ```html + +