Skip to content

Commit 682330e

Browse files
authored
Merge branch 'develop' into docker/doc
2 parents bcd06d5 + c3d0d0d commit 682330e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+5729
-3992
lines changed

.codesandbox/ci.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"sandboxes": ["2d17z"],
3+
"packages": [".", "packages/docsify-server-renderer"]
4+
}

.editorconfig

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# http://EditorConfig.org
2+
3+
root = true
4+
5+
[*]
6+
charset = utf-8
7+
indent_style = space
8+
indent_size = 2
9+
end_of_line = lf
10+
insert_final_newline = true
11+
trim_trailing_whitespace = true

.eslintrc.js

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module.exports = {
1919
rules: {
2020
'prettier/prettier': ['error'],
2121
camelcase: ['warn'],
22+
'no-useless-escape': ['warn'],
2223
curly: ['error', 'all'],
2324
'dot-notation': ['error'],
2425
eqeqeq: ['error'],

.github/ISSUE_TEMPLATE/bug_report.md

+7
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ about: Create a report to help us improve
77
<!-- Please use English language -->
88
<!-- Before creating an issue please make sure you are using the latest version of Docsify. -->
99
<!-- Please ask questions on StackOverflow: https://stackoverflow.com/questions/ask?tags=docsify -->
10+
<!-- Please ask questions on gitter: https://gitter.im/docsifyjs/Lobby -->
1011

1112
## Bug Report
1213

@@ -36,3 +37,9 @@ about: Create a report to help us improve
3637

3738
<!-- Love docsify? Please consider supporting our collective:
3839
👉 https://opencollective.com/docsify/donate -->
40+
41+
#### Please create a reproducible sandbox
42+
43+
[![Edit 307qqv236](https://codesandbox.io/static/img/play-codesandbox.svg)](https://codesandbox.io/s/307qqv236)
44+
45+
#### Mention the docsify version in which this bug was not present (if any)

.github/semantic.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
titleAndCommits: true
2+
allowMergeCommits: true
3+
allowRevertCommits: true
4+
anyCommit: true

.gitpod.yml

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
tasks:
2+
- command: gp await-port 3000 && sleep 3 && gp preview $(gp url 3000)
3+
- init: npm install
4+
command: npm run dev
5+
ports:
6+
- port: 3000
7+
onOpen: ignore
8+
vscode:
9+
extensions:
10+
- [email protected]:xX39oruAJ5UQzTNVRdbBaQ==

CHANGELOG.md

+47
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,50 @@
1+
## [4.11.4](https://github.com/docsifyjs/docsify/compare/v4.11.3...v4.11.4) (2020-06-18)
2+
3+
4+
### Bug Fixes
5+
6+
* consistent location of search result ([e9dd2de](https://github.com/docsifyjs/docsify/commit/e9dd2de384b81619aae2bcbf92f52721cb76a177))
7+
* cover overlapping sidebar by removing z-index ([0bf03f5](https://github.com/docsifyjs/docsify/commit/0bf03f58103037d100b1635cf3989c8d3672b4ba))
8+
* cross-origin url cannot be redirected when "externalLinkTarget" is set to "_self" and "routerMode" is set to "history". ([#1062](https://github.com/docsifyjs/docsify/issues/1062)) ([fd2cec6](https://github.com/docsifyjs/docsify/commit/fd2cec6bd66c46d6957811fefae4c615c3052a4f)), closes [#1046](https://github.com/docsifyjs/docsify/issues/1046) [#1046](https://github.com/docsifyjs/docsify/issues/1046) [#1046](https://github.com/docsifyjs/docsify/issues/1046)
9+
* default html img resize if no height included ([#1065](https://github.com/docsifyjs/docsify/issues/1065)) ([9ff4d06](https://github.com/docsifyjs/docsify/commit/9ff4d0677304bc190e7bd9e89bbbdc64895197fa))
10+
* fixed target and rel issue (fixes [#1183](https://github.com/docsifyjs/docsify/issues/1183)) ([3d662a5](https://github.com/docsifyjs/docsify/commit/3d662a5bf71bbfef077cfbc478df241d794f55a0))
11+
* Inconsistent search and body rendering ([dcb0aae](https://github.com/docsifyjs/docsify/commit/dcb0aaea99efbd68175f1d1aeb5076b6dde9801e))
12+
* rendering cover width bug ([717991c](https://github.com/docsifyjs/docsify/commit/717991c90cf709f4da91fe32610129de6529266b))
13+
* search does not find the contents of the table ([#1198](https://github.com/docsifyjs/docsify/issues/1198)) ([31010e4](https://github.com/docsifyjs/docsify/commit/31010e4979b3d3ab4bd247a09c4ac5fd1405eaa8))
14+
* The search error after setting the ID in the title ([#1159](https://github.com/docsifyjs/docsify/issues/1159)) ([6e554f8](https://github.com/docsifyjs/docsify/commit/6e554f8ebd3d4a2c5c7e4f66cff3dfe2b6aa1e31))
15+
* upgrade docsify from 4.10.2 to 4.11.2 ([60b7f89](https://github.com/docsifyjs/docsify/commit/60b7f89b373b0d48ec8406a51eddeaed8126696d))
16+
17+
18+
### Features
19+
20+
* added html sanitizer for remote rendering ([#1128](https://github.com/docsifyjs/docsify/issues/1128)) ([714ef29](https://github.com/docsifyjs/docsify/commit/714ef29afe779a6db5c4761ebaacdfc70ee2d8dd))
21+
* update src/core/index.js to export all global APIs, deprecate old globals in favor of a single global DOCSIFY, and add tests for this ([7e002bf](https://github.com/docsifyjs/docsify/commit/7e002bf939d7837843908417b5445b4f8d36c1cd))
22+
23+
24+
### Reverts
25+
26+
* Revert "Updated docs site dark and light mode with switch and redesigned search bar using docsify-darklight-theme" (#1207) ([26cb940](https://github.com/docsifyjs/docsify/commit/26cb940b51d34ee584b8425012a336f38a4abd76)), closes [#1207](https://github.com/docsifyjs/docsify/issues/1207) [#1182](https://github.com/docsifyjs/docsify/issues/1182)
27+
28+
29+
30+
## [4.11.3](https://github.com/docsifyjs/docsify/compare/v4.11.2...v4.11.3) (2020-03-24)
31+
32+
33+
### Bug Fixes
34+
35+
* fix: digit issue with sidebar (complete REVERT to old method) ([154abf5](https://github.com/docsifyjs/docsify/commit/154abf59a6153e84b018fcdffa86892776d6da7d))
36+
37+
38+
39+
## [4.11.2](https://github.com/docsifyjs/docsify/compare/v4.11.1...v4.11.2) (2020-03-09)
40+
41+
42+
### Bug Fixes
43+
44+
* fixed rendering of color in coverpage issue ([406670c](https://github.com/docsifyjs/docsify/commit/406670c3d619a627142900fd45019fb8ce00f60a))
45+
46+
47+
148
## [4.11.1](https://github.com/docsifyjs/docsify/compare/v4.11.0...v4.11.1) (2020-03-09)
249

350

README.md

+13
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
1919
<a href="https://github.com/QingWei-Li/donate"><img alt="donate" src="https://img.shields.io/badge/%24-donate-ff69b4.svg?style=flat-square"></a>
2020
<a href="https://gitter.im/docsifyjs/Lobby?utm_source=share-link&utm_medium=link&utm_campaign=share-link"><img alt="gitter" src="https://img.shields.io/gitter/room/docsifyjs/docsify.svg?style=flat-square"></a>
21+
<a href="https://gitpod.io/#https://github.com/docsifyjs/docsify"><img src="https://img.shields.io/badge/Gitpod-ready--to--code-blue?logo=gitpod" alt="Gitpod Ready-to-Code"></a>
2122
</p>
2223

2324
<p align="center">Gold Sponsor via <a href="https://opencollective.com/docsify">Open Collective</a></p>
@@ -69,6 +70,18 @@ Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
6970

7071
## Contributing
7172

73+
### Online one-click setup for Contributing
74+
75+
You can use Gitpod(A free online VS Code-like IDE) for contributing. With single click it'll launch a workspace and automatically:
76+
77+
- clone the docsify repo.
78+
- install the dependencies.
79+
- start `npm run dev`.
80+
81+
So that you can start straight away.
82+
83+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/docsifyjs/docsify)
84+
7285
- Fork it!
7386
- Create your feature branch: `git checkout -b my-new-feature`
7487
- Commit your changes: `git commit -am 'Add some feature'`

build/build.js

+73-49
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,16 @@ const version = process.env.VERSION || require('../package.json').version
99
const chokidar = require('chokidar')
1010
const path = require('path')
1111

12-
const build = function (opts) {
13-
rollup
12+
/**
13+
* @param {{
14+
* input: string,
15+
* output?: string,
16+
* globalName?: string,
17+
* plugins?: Array<import('rollup').Plugin>
18+
* }} opts
19+
*/
20+
async function build(opts) {
21+
await rollup
1422
.rollup({
1523
input: opts.input,
1624
plugins: (opts.plugins || []).concat([
@@ -27,31 +35,35 @@ const build = function (opts) {
2735
var dest = 'lib/' + (opts.output || opts.input)
2836

2937
console.log(dest)
30-
bundle.write({
38+
return bundle.write({
3139
format: 'iife',
40+
output: opts.globalName ? {name: opts.globalName} : {},
3241
file: dest,
3342
strict: false
3443
})
3544
})
36-
.catch(function (err) {
37-
console.error(err)
38-
})
3945
}
40-
const buildCore = function () {
41-
build({
46+
47+
async function buildCore() {
48+
const promises = []
49+
50+
promises.push(build({
4251
input: 'src/core/index.js',
43-
output: 'docsify.js'
44-
})
52+
output: 'docsify.js',
53+
}))
4554

4655
if (isProd) {
47-
build({
56+
promises.push(build({
4857
input: 'src/core/index.js',
4958
output: 'docsify.min.js',
5059
plugins: [uglify()]
51-
})
60+
}))
5261
}
62+
63+
await Promise.all(promises)
5364
}
54-
const buildAllPlugin = function () {
65+
66+
async function buildAllPlugin() {
5567
var plugins = [
5668
{name: 'search', input: 'search/index.js'},
5769
{name: 'ga', input: 'ga.js'},
@@ -64,56 +76,68 @@ const buildAllPlugin = function () {
6476
{name: 'gitalk', input: 'gitalk.js'}
6577
]
6678

67-
plugins.forEach(item => {
68-
build({
79+
const promises = plugins.map(item => {
80+
return build({
6981
input: 'src/plugins/' + item.input,
7082
output: 'plugins/' + item.name + '.js'
7183
})
7284
})
7385

7486
if (isProd) {
7587
plugins.forEach(item => {
76-
build({
88+
promises.push(build({
7789
input: 'src/plugins/' + item.input,
7890
output: 'plugins/' + item.name + '.min.js',
7991
plugins: [uglify()]
80-
})
92+
}))
8193
})
8294
}
95+
96+
await Promise.all(promises)
8397
}
8498

85-
if (!isProd) {
86-
chokidar
87-
.watch(['src/core', 'src/plugins'], {
88-
atomic: true,
89-
awaitWriteFinish: {
90-
stabilityThreshold: 1000,
91-
pollInterval: 100
92-
}
93-
})
94-
.on('change', p => {
95-
console.log('[watch] ', p)
96-
const dirs = p.split(path.sep)
97-
if (dirs[1] === 'core') {
98-
buildCore()
99-
} else if (dirs[2]) {
100-
const name = path.basename(dirs[2], '.js')
101-
const input = `src/plugins/${name}${
102-
/\.js/.test(dirs[2]) ? '' : '/index'
103-
}.js`
99+
async function main() {
100+
if (!isProd) {
101+
chokidar
102+
.watch(['src/core', 'src/plugins'], {
103+
atomic: true,
104+
awaitWriteFinish: {
105+
stabilityThreshold: 1000,
106+
pollInterval: 100
107+
}
108+
})
109+
.on('change', p => {
110+
console.log('[watch] ', p)
111+
const dirs = p.split(path.sep)
112+
if (dirs[1] === 'core') {
113+
buildCore()
114+
} else if (dirs[2]) {
115+
const name = path.basename(dirs[2], '.js')
116+
const input = `src/plugins/${name}${
117+
/\.js/.test(dirs[2]) ? '' : '/index'
118+
}.js`
104119

105-
build({
106-
input,
107-
output: 'plugins/' + name + '.js'
108-
})
109-
}
110-
})
111-
.on('ready', () => {
112-
console.log('[start]')
113-
buildCore()
120+
build({
121+
input,
122+
output: 'plugins/' + name + '.js'
123+
})
124+
}
125+
})
126+
.on('ready', () => {
127+
console.log('[start]')
128+
buildCore()
129+
buildAllPlugin()
130+
})
131+
} else {
132+
await Promise.all([
133+
buildCore(),
114134
buildAllPlugin()
115-
})
116-
} else {
117-
buildCore()
118-
buildAllPlugin()
135+
])
136+
}
119137
}
138+
139+
main().catch((e) => {
140+
console.error(e)
141+
process.exit(1)
142+
})
143+

build/css.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ const {spawn} = require('child_process')
55
const args = process.argv.slice(2)
66
fs.readdir(path.join(__dirname, '../src/themes'), (err, files) => {
77
if (err) {
8-
console.log('err', err)
9-
return
8+
console.error('err', err)
9+
process.exit(1)
1010
}
1111
files.map(async (file) => {
1212
if (/\.styl/g.test(file)) {
@@ -31,11 +31,17 @@ fs.readdir(path.join(__dirname, '../src/themes'), (err, files) => {
3131
});
3232

3333
stylusCMD.on('close', (code) => {
34-
console.log(`[Stylus Build ] child process exited with code ${code}`);
34+
const message = `[Stylus Build ] child process exited with code ${code}`
35+
36+
if (code !== 0) {
37+
console.error(message);
38+
process.exit(code)
39+
}
40+
console.log(message);
3541
});
3642
} else {
3743
return
3844
}
3945

4046
})
41-
})
47+
})

build/mincss.js

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@ files.forEach(file => {
88
file = path.resolve('lib/themes', file)
99
cssnano(fs.readFileSync(file)).then(result => {
1010
fs.writeFileSync(file, result.css)
11+
}).catch(e => {
12+
console.error(e)
13+
process.exit(1)
1114
})
1215
})

build/ssr.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,12 @@ rollup
2424
var dest = 'packages/docsify-server-renderer/build.js'
2525

2626
console.log(dest)
27-
bundle.write({
27+
return bundle.write({
2828
format: 'cjs',
2929
file: dest
3030
})
3131
})
3232
.catch(function (err) {
3333
console.error(err)
34+
process.exit(1)
3435
})

cypress/fixtures/tpl/docs.index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<meta name="description" content="A magical documentation generator." />
1717
<meta
1818
name="viewport"
19-
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"
19+
content="width=device-width, initial-scale=1.0, minimum-scale=1.0"
2020
/>
2121
<link rel="stylesheet" href="lib/themes/vue.css" title="vue" />
2222
<link rel="stylesheet" href="lib/themes/dark.css" title="dark" disabled />

docs/_coverpage.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![logo](_media/icon.svg)
22

3-
# docsify <small>4.11.1</small>
3+
# docsify <small>4.11.4</small>
44

55
> A magical documentation site generator.
66

docs/_media/example-with-yaml.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
author: John Smith
3+
date: 2020-1-1
4+
---
5+
6+
> This is from the `example.md`

0 commit comments

Comments
 (0)