Skip to content

Commit b896d63

Browse files
authored
Merge branch 'develop' into patch-1
2 parents 190de35 + 750663e commit b896d63

File tree

19 files changed

+141
-69
lines changed

19 files changed

+141
-69
lines changed

Diff for: .github/PULL_REQUEST_TEMPLATE.md

+1-8
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
- [ ] Refactor
1515
- [ ] Docs
1616
- [ ] Build-related changes
17+
- [ ] Repo settings
1718
- [ ] Other, please describe:
1819

1920
If changing the UI of default theme, please provide the **before/after** screenshot:
@@ -44,11 +45,3 @@ If adding a **new feature**, the PR's description includes:
4445
- [ ] Related tests have been updated
4546

4647
To avoid wasting your time, it's best to open a **feature request issue** first and wait for approval before working on it.
47-
48-
49-
**Other information:**
50-
51-
---
52-
53-
* [ ] DO NOT include files inside `lib` directory.
54-

Diff for: .gitignore

+5-5
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
.DS_Store
33
.idea
44
node_modules
5-
themes/
6-
lib/
7-
cypress/integration/examples
8-
cypress/fixtures/docs
5+
/themes/
6+
/lib/
7+
/cypress/integration/examples
8+
/cypress/fixtures/docs
99

1010
# exceptions
11-
!.gitkeep
11+
!.gitkeep

Diff for: docs/cdn.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ Alternatively, use [compressed files](#compressed-file).
4444

4545
## Other CDN
4646

47-
- http://www.bootcdn.cn/docsify
47+
- https://www.bootcdn.cn/docsify/
4848
- https://cdn.jsdelivr.net/npm/docsify/
4949
- https://cdnjs.com/libraries/docsify
50-
50+
- https://unpkg.com/browse/docsify/

Diff for: docs/configuration.md

+16-16
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ You can configure Docsify by defining `window.$docsify` as an object:
1212
</script>
1313
```
1414

15-
The config can also be defined as a function, in which case the first arg is the Docsify `vm` instance. The function should return a config object. This can be useful for referencing `vm` in places like the markdown configuration:
15+
The config can also be defined as a function, in which case the first argument is the Docsify `vm` instance. The function should return a config object. This can be useful for referencing `vm` in places like the markdown configuration:
1616

1717
```html
1818
<script>
@@ -35,7 +35,7 @@ The config can also be defined as a function, in which case the first arg is the
3535
- Type: `String`
3636
- Default: `#app`
3737

38-
The DOM element to be mounted on initialization. It can be a CSS selector string or an actual HTMLElement.
38+
The DOM element to be mounted on initialization. It can be a CSS selector string or an actual [HTMLElement](https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement).
3939

4040
```js
4141
window.$docsify = {
@@ -48,7 +48,7 @@ window.$docsify = {
4848
- Type: `String`
4949
- Default: `null`
5050

51-
Configure the repository url or a string of `username/repo` can add the [GitHub Corner](http://tholman.com/github-corners/) widget in the top right corner of the site.
51+
Configure the repository url, or a string of `username/repo` can add the [GitHub Corner](http://tholman.com/github-corners/) widget in the top right corner of the site.
5252

5353
```js
5454
window.$docsify = {
@@ -76,7 +76,7 @@ window.$docsify = {
7676
- Type: `Boolean|String`
7777
- Default: `false`
7878

79-
Loads navbar from the Markdown file `_navbar.md` if **true**, or else from the path specified.
79+
Loads navbar from the Markdown file `_navbar.md` if **true**, else loads it from the path specified.
8080

8181
```js
8282
window.$docsify = {
@@ -93,7 +93,7 @@ window.$docsify = {
9393
- Type: `Boolean|String`
9494
- Default: `false`
9595

96-
Loads sidebar from the Markdown file `_sidebar.md` if **true**, or else from the path specified.
96+
Loads sidebar from the Markdown file `_sidebar.md` if **true**, else loads it from the path specified.
9797

9898
```js
9999
window.$docsify = {
@@ -110,7 +110,7 @@ window.$docsify = {
110110
- Type : `Boolean`
111111
- Default: `true`
112112

113-
This option will completely hide your sidebar and wont render any content of the side even .
113+
This option will completely hide your sidebar and won't render any content on the side.
114114

115115
```js
116116
window.$docsify = {
@@ -149,7 +149,7 @@ window.$docsify = {
149149
- Type: `String`
150150
- Default: `README.md`
151151

152-
`README.md` in your docs folder will be treated as homepage for your website, but sometimes you may need to serve another file as your homepage.
152+
`README.md` in your docs folder will be treated as the homepage for your website, but sometimes you may need to serve another file as your homepage.
153153

154154
```js
155155
window.$docsify = {
@@ -196,7 +196,7 @@ window.$docsify = {
196196
- Type: `Boolean`
197197
- Default: `false`
198198

199-
If **true** links are relative to the current context.
199+
If **true**, links are relative to the current context.
200200

201201
For example, the directory structure is as follows:
202202

@@ -260,7 +260,7 @@ window.$docsify = {
260260

261261
- Type: `String`
262262

263-
Website logo as it appears in the sidebar, you can resize by CSS.
263+
Website logo as it appears in the sidebar. You can resize it by using CSS.
264264

265265
```js
266266
window.$docsify = {
@@ -367,7 +367,7 @@ window.$docsify = {
367367

368368
- type: `Boolean`
369369

370-
If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to html. Compare [#78](https://github.com/docsifyjs/docsify/issues/78).
370+
If `loadSidebar` and `autoHeader` are both enabled, for each link in `_sidebar.md`, prepend a header to the page before converting it to HTML. Compare [#78](https://github.com/docsifyjs/docsify/issues/78).
371371

372372
```js
373373
window.$docsify = {
@@ -474,7 +474,7 @@ window.$docsify = {
474474
- type: `String`
475475
- default: `noopener`
476476

477-
Default `'noopener'` (no opener) prevents the newly opened external page (when [externalLinkTarget](#externallinktarget) is `'_blank'`) from having the ability to control our page. No `rel` is set when its not `'_blank'`. See [this post](https://mathiasbynens.github.io/rel-noopener/) for more information about why you may want to use this option.
477+
Default `'noopener'` (no opener) prevents the newly opened external page (when [externalLinkTarget](#externallinktarget) is `'_blank'`) from having the ability to control our page. No `rel` is set when it's not `'_blank'`. See [this post](https://mathiasbynens.github.io/rel-noopener/) for more information about why you may want to use this option.
478478

479479
```js
480480
window.$docsify = {
@@ -557,13 +557,13 @@ window.$docsify = {
557557

558558
- type: `Array<string>`
559559

560-
List of languages that will fallback to the default language when a page is request and didn't exists for the given local.
560+
List of languages that will fallback to the default language when a page is requested and it doesn't exist for the given local.
561561

562562
Example:
563563

564-
- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed
565-
- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed
566-
- then display 404 page.
564+
- try to fetch the page of `/de/overview`. If this page exists, it'll be displayed.
565+
- then try to fetch the default page `/overview` (depending on the default language). If this page exists, it'll be displayed.
566+
- then display the 404 page.
567567

568568
```js
569569
window.$docsify = {
@@ -583,7 +583,7 @@ window.$docsify = {
583583
};
584584
```
585585

586-
Load the customised path of the 404 page:
586+
Load the customized path of the 404 page:
587587

588588
```js
589589
window.$docsify = {

Diff for: docs/helpers.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
docsify extends Markdown syntax to make your documents more readable.
44

5-
> Note: For the special code syntax cases, you'd better put them within a code backticks to avoid any conflicting from configurations or emojis.
5+
> Note: For the special code syntax cases, you'd better put them within a code backticks to avoid any conflicting from configurations or emojis.
66
77
## important content
88

@@ -70,7 +70,7 @@ You will get `<a href="/demo/">link</a>`html. Do not worry, you can still set ti
7070
Only when you both set the `routerMode: 'history'` and `externalLinkTarget: '_self'`, you need add this configuration for those Cross-Origin links.
7171

7272
```md
73-
[example.com](https://example.com/ ':crossorgin')
73+
[example.com](https://example.com/ ':crossorgin')
7474
```
7575

7676
## Github Task Lists
@@ -124,7 +124,7 @@ Only when you both set the `routerMode: 'history'` and `externalLinkTarget: '_se
124124
## Customise ID for headings
125125

126126
```md
127-
### 你好,世界! :id=hello-world
127+
### Hello, world! :id=hello-world
128128
```
129129

130130
## Markdown in html tag

Diff for: docs/index.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,8 @@
3333
'/zh-cn/(.*)': 'https://cdn.jsdelivr.net/gh/docsifyjs/docs-zh@master/$1',
3434
'/de-de/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
3535
'/ru-ru/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
36-
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1'
36+
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1',
37+
'/write-a-plugin': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/docs/write-a-plugin.md'
3738
},
3839
auto2top: true,
3940
coverpage: true,
@@ -62,7 +63,6 @@
6263
'/': 'Search'
6364
}
6465
},
65-
formatUpdated: '{MM}/{DD} {HH}:{mm}',
6666
plugins: [
6767
function (hook, vm) {
6868
hook.beforeEach(function (html) {

Diff for: docs/more-pages.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -114,24 +114,24 @@ A custom sidebar can also automatically generate a table of contents by setting
114114

115115
## Ignoring Subheaders
116116

117-
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `{docsify-ignore}` to it.
117+
When `subMaxLevel` is set, each header is automatically added to the table of contents by default. If you want to ignore a specific header, add `<!-- {docsify-ignore} -->` to it.
118118

119119
```markdown
120120
# Getting Started
121121

122-
## Header {docsify-ignore}
122+
## Header <!-- {docsify-ignore} -->
123123

124124
This header won't appear in the sidebar table of contents.
125125
```
126126

127-
To ignore all headers on a specific page, you can use `{docsify-ignore-all}` on the first header of the page.
127+
To ignore all headers on a specific page, you can use `<!-- {docsify-ignore-all} -->` on the first header of the page.
128128

129129
```markdown
130-
# Getting Started {docsify-ignore-all}
130+
# Getting Started <!-- {docsify-ignore-all} -->
131131

132132
## Header
133133

134134
This header won't appear in the sidebar table of contents.
135135
```
136136

137-
Both `{docsify-ignore}` and `{docsify-ignore-all}` will not be rendered on the page when used.
137+
Both `<!-- {docsify-ignore} -->` and `<!-- {docsify-ignore-all} -->` will not be rendered on the page when used.

Diff for: docs/plugins.md

+11
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,17 @@ By default, the hyperlink on the current page is recognized and the content is s
4444
// To avoid search index collision
4545
// between multiple websites under the same domain
4646
namespace: 'website-1',
47+
48+
// Use different indexes for path prefixes (namespaces).
49+
// NOTE: Only works in 'auto' mode.
50+
//
51+
// When initialiazing an index, we look for the first path from the sidebar.
52+
// If it matches the prefix from the list, we switch to the corresponding index.
53+
pathNamespaces: ['/zh-cn', '/ru-ru', '/ru-ru/v1'],
54+
55+
// You can provide a regexp to match prefixes. In this case,
56+
// the matching substring will be used to identify the index
57+
pathNamespaces: /^(\/(zh-cn|ru-ru))?(\/(v1|v2))?/
4758
}
4859
}
4960
</script>

Diff for: index.html

+9-7
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="/themes/vue.css" title="vue">
1010
<link rel="stylesheet" href="/themes/dark.css" title="dark" disabled>
1111
<link rel="stylesheet" href="/themes/buble.css" title="buble" disabled>
12+
<link rel="stylesheet" href="/themes/pure.css" title="pure" disabled>
1213
<style>
1314
nav.app-nav li ul {
1415
min-width: 100px;
@@ -27,7 +28,8 @@
2728
'/zh-cn/(.*)': 'https://cdn.jsdelivr.net/gh/docsifyjs/docs-zh@master/$1',
2829
'/de-de/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-de/master/$1',
2930
'/ru-ru/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-ru/master/$1',
30-
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1'
31+
'/es/(.*)': 'https://raw.githubusercontent.com/docsifyjs/docs-es/master/$1',
32+
'/write-a-plugin': 'https://raw.githubusercontent.com/docsifyjs/docsify/master/docs/write-a-plugin.md'
3133
},
3234
auto2top: true,
3335
basePath: '/docs/',
@@ -50,9 +52,9 @@
5052
'/de-de/': 'Suche',
5153
'/zh-cn/': '搜索',
5254
'/': 'Search'
53-
}
55+
},
56+
pathNamespaces: ['/zh-cn', '/de-de', '/ru-ru', '/es']
5457
},
55-
formatUpdated: '{MM}/{DD} {HH}:{mm}',
5658
plugins: [
5759
function (hook, vm) {
5860
hook.beforeEach(function (html) {
@@ -68,7 +70,6 @@
6870
url = 'https://github.com/docsifyjs/docsify/blob/master/docs/' + vm.route.file
6971
}
7072
var editHtml = '[:memo: Edit Document](' + url + ')\n'
71-
7273
return editHtml
7374
+ html
7475
+ '\n\n----\n\n'
@@ -82,9 +83,10 @@
8283
<script src="/lib/plugins/search.js"></script>
8384
<script src="/lib/plugins/emoji.js"></script>
8485
<script src="/lib/plugins/front-matter.js"></script>
85-
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
86-
<script src="//unpkg.com/prismjs/components/prism-markdown.min.js"></script>
87-
<script src="//unpkg.com/prismjs/components/prism-nginx.min.js"></script>
86+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-bash.min.js"></script>
87+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-markdown.min.js"></script>
88+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-nginx.min.js"></script>
89+
<script src="//cdn.jsdelivr.net/npm/prismjs/components/prism-php.min.js"></script>
8890
</body>
8991

9092
</html>

Diff for: packages/docsify-server-renderer/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ var readFileSync = require('fs').readFileSync
1414

1515
// init
1616
var renderer = new Renderer({
17-
template: readFileSync('./docs/index.template.html', 'utf-8').,
17+
template: readFileSync('./docs/index.template.html', 'utf-8'),
1818
config: {
1919
name: 'docsify',
2020
repo: 'docsifyjs/docsify'
@@ -35,12 +35,12 @@ renderer.renderToString(url)
3535
<meta charset="UTF-8">
3636
<title>docsify</title>
3737
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
38-
<link rel="stylesheet" href="//unpkg.com/docsify/themes/buble.css" title="buble" disabled>
38+
<link rel="stylesheet" href="//cdn.jsdelivr.net/npm/docsify/themes/vue.css" title="vue">
3939
</head>
4040
<body>
4141
<!--inject-app-->
4242
<!--inject-config-->
43-
<script src="//unpkg.com/docsify/lib/docsify.js"></script>
43+
<script src="//cdn.jsdelivr.net/npm/docsify/lib/docsify.js"></script>
4444
</body>
4545
</html>
4646
```

Diff for: src/core/event/scroll.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,12 @@ function highlight(path) {
7979
const isInView =
8080
active.offsetTop >= wrap.scrollTop && cur <= wrap.scrollTop + height;
8181
const notThan = cur - curOffset < height;
82-
const top = isInView ? wrap.scrollTop : notThan ? curOffset : cur - height;
8382

84-
sidebar.scrollTop = top;
83+
sidebar.scrollTop = isInView
84+
? wrap.scrollTop
85+
: notThan
86+
? curOffset
87+
: cur - height;
8588
}
8689
}
8790

Diff for: src/core/event/sidebar.js

+2
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,8 @@ export function getAndActive(router, el, isParent, autoTitle) {
8686
const href = a.getAttribute('href');
8787
const node = isParent ? a.parentNode : a;
8888

89+
a.title = a.innerText;
90+
8991
if (hash.indexOf(href) === 0 && !target) {
9092
target = a;
9193
dom.toggleClass(node, 'add', 'active');

Diff for: src/core/render/compiler.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -208,14 +208,14 @@ export class Compiler {
208208
let { str, config } = getAndRemoveConfig(text);
209209
const nextToc = { level, title: str };
210210

211-
if (/{docsify-ignore}/g.test(str)) {
212-
str = str.replace('{docsify-ignore}', '');
211+
if (/<!-- {docsify-ignore} -->/g.test(str)) {
212+
str = str.replace('<!-- {docsify-ignore} -->', '');
213213
nextToc.title = str;
214214
nextToc.ignoreSubHeading = true;
215215
}
216216

217-
if (/{docsify-ignore-all}/g.test(str)) {
218-
str = str.replace('{docsify-ignore-all}', '');
217+
if (/<!-- {docsify-ignore-all} -->/g.test(str)) {
218+
str = str.replace('<!-- {docsify-ignore-all} -->', '');
219219
nextToc.title = str;
220220
nextToc.ignoreAllSubs = true;
221221
}

0 commit comments

Comments
 (0)