Skip to content

Commit 6428c84

Browse files
author
路遥知码力
authored
Merge branch 'develop' into fix-ssr-error
2 parents 208ab87 + 3c9b3d9 commit 6428c84

File tree

123 files changed

+41688
-12344
lines changed

Some content is hidden

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

123 files changed

+41688
-12344
lines changed

.codesandbox/ci.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
22
"sandboxes": ["2d17z"],
3-
"packages": [".", "packages/docsify-server-renderer"]
3+
"packages": [".", "packages/docsify-server-renderer"],
4+
"node": "16"
45
}

.eslintignore

+5-6
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
.git
2-
packages/docsify-server-renderer/build.js
3-
node_modules
2+
**/*.md
43
build
5-
server.js
4+
docs
65
lib
6+
node_modules
7+
packages/docsify-server-renderer/build.js
8+
server.js
79
themes
8-
build
9-
docs/
10-
**/*.md

.eslintrc.js

+31-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,28 @@
1+
const prettierConfig = require('./.prettierrc');
2+
13
module.exports = {
24
root: true,
3-
parser: 'babel-eslint',
5+
extends: [
6+
'eslint:recommended',
7+
'plugin:import/recommended',
8+
'plugin:prettier/recommended', // Must be last
9+
],
10+
parser: '@babel/eslint-parser',
411
parserOptions: {
512
sourceType: 'module',
613
ecmaVersion: 2019,
714
},
15+
plugins: ['prettier', 'import'],
816
env: {
917
browser: true,
10-
node: true,
1118
es6: true,
19+
node: true,
1220
},
13-
plugins: ['prettier', 'import'],
14-
extends: ['eslint:recommended', 'plugin:import/recommended'],
1521
settings: {
1622
'import/ignore': ['node_modules', '.json$'],
1723
},
1824
rules: {
19-
'prettier/prettier': ['error'],
2025
camelcase: ['warn'],
21-
'no-useless-escape': ['warn'],
2226
curly: ['error', 'all'],
2327
'dot-notation': ['error'],
2428
eqeqeq: ['error'],
@@ -33,9 +37,23 @@ module.exports = {
3337
'no-proto': ['error'],
3438
'no-return-assign': ['error'],
3539
'no-self-compare': ['error'],
36-
'no-shadow': ['warn'],
3740
'no-shadow-restricted-names': ['error'],
41+
'no-shadow': [
42+
'error',
43+
{
44+
allow: [
45+
'Events',
46+
'Fetch',
47+
'Lifecycle',
48+
'Render',
49+
'Router',
50+
'VirtualRoutes',
51+
],
52+
},
53+
],
54+
'no-unused-vars': ['error', { args: 'none' }],
3855
'no-useless-call': ['error'],
56+
'no-useless-escape': ['warn'],
3957
'no-var': ['error'],
4058
'no-void': ['error'],
4159
'no-with': ['error'],
@@ -46,18 +64,21 @@ module.exports = {
4664

4765
// Import rules
4866
// Search way how integrate with `lerna`
49-
'import/no-unresolved': 'off',
5067
'import/imports-first': ['error'],
5168
'import/newline-after-import': ['error'],
5269
'import/no-duplicates': ['error'],
5370
'import/no-mutable-exports': ['error'],
54-
'import/no-named-as-default': ['error'],
5571
'import/no-named-as-default-member': ['error'],
72+
'import/no-named-as-default': ['error'],
73+
'import/no-unresolved': 'off',
5674
'import/order': ['warn'],
75+
76+
// Prettier (Must be last)
77+
'prettier/prettier': ['warn', prettierConfig],
5778
},
5879
globals: {
59-
Docsify: 'writable',
6080
$docsify: 'writable',
81+
Docsify: 'writable',
6182
dom: 'writable',
6283
},
6384
};

.github/workflows/lint.yml

-30
This file was deleted.

.github/workflows/test.yml

+59-22
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,78 @@ name: Build & Test
22

33
on:
44
push:
5-
branches:
6-
- master
7-
- develop
5+
branches: [master, develop]
86
pull_request:
9-
branches:
10-
- master
11-
- develop
7+
branches: [master, develop]
128

139
jobs:
14-
build:
10+
lint:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
node-version: ['lts/*']
15+
steps:
16+
- uses: actions/checkout@v2
17+
- name: Setup Node.js ${{ matrix.node-version }}
18+
uses: actions/setup-node@v2
19+
with:
20+
node-version: ${{ matrix.node-version }}
21+
cache: 'npm'
22+
- name: Install dependencies
23+
run: npm ci --ignore-scripts
24+
- name: Build
25+
run: npm run build
26+
- name: Lint
27+
run: npm run lint
28+
29+
test-jest:
1530
runs-on: ${{ matrix.os }}
1631
strategy:
1732
fail-fast: false
1833
matrix:
19-
node-version: [12.x, 14.x]
34+
node-version: ['lts/*']
2035
os: ['macos-latest', 'ubuntu-latest', 'windows-latest']
36+
steps:
37+
- uses: actions/checkout@v2
38+
- name: Setup Node.js ${{ matrix.node-version }}
39+
uses: actions/setup-node@v2
40+
with:
41+
node-version: ${{ matrix.node-version }}
42+
cache: 'npm'
43+
- name: Install dependencies
44+
run: npm ci --ignore-scripts
45+
- name: Build
46+
run: npm run build
47+
- name: Unit Tests
48+
run: npm run test:unit -- --ci --runInBand
49+
- name: Integration Tests
50+
run: npm run test:integration -- --ci --runInBand
2151

52+
test-playwright:
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
node-version: ['lts/*']
2257
steps:
2358
- uses: actions/checkout@v2
24-
- name: Use Node.js ${{ matrix.node-version }}
25-
uses: actions/setup-node@v1
59+
- name: Setup Node.js ${{ matrix.node-version }}
60+
uses: actions/setup-node@v2
2661
with:
2762
node-version: ${{ matrix.node-version }}
28-
- name: bootstrap
29-
run: npm run bootstrap
30-
- name: unit tests
31-
run: npm run test:unit -- -ci --runInBand
32-
- name: integration tests
33-
run: npm run test:integration -- -ci --runInBand
34-
- uses: microsoft/playwright-github-action@v1
35-
- name: e2e tests
36-
run: npm run test:e2e -- --ci --runInBand
37-
- name: Upload artifacts (diff output)
63+
cache: 'npm'
64+
- name: Install dependencies
65+
run: npm ci --ignore-scripts
66+
- name: Build
67+
run: npm run build
68+
- name: Install Playwright
69+
run: npx playwright install --with-deps
70+
- name: E2E Tests (Playwright)
71+
run: npm run test:e2e
72+
- name: Store artifacts
3873
uses: actions/upload-artifact@v2
3974
if: failure()
4075
with:
41-
name: ${{ matrix.os }}-${{ matrix.node-version }}-diff-output
42-
path: ${{ github.workspace }}/test/**/__diff_output__/*
76+
name: ${{ matrix.os }}-${{ matrix.node-version }}-artifacts
77+
path: |
78+
_playwright-results/
79+
_playwright-report/

.gitignore

+6-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
*.log
21
.DS_Store
32
.idea
4-
__diff_output__
5-
lib/
6-
node_modules
7-
themes/
3+
*.log
4+
/_playwright-report
5+
/_playwright-results
6+
/lib
7+
/node_modules
8+
/themes
89

910
# exceptions
1011
!.gitkeep

.npmignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.eslintignore
22
.eslintrc
3-
.github/
3+
.github
44
.gitignore
55
.travis.yml

.prettierrc.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
module.exports = {
2+
arrowParens: 'avoid',
23
singleQuote: true,
3-
trailingComma: 'es5',
44
};

.vscode/settings.json

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
{
2-
"editor.defaultFormatter": "esbenp.prettier-vscode"
2+
"editor.defaultFormatter": "esbenp.prettier-vscode",
3+
"cSpell.words": ["coverpage"]
34
}

CHANGELOG.md

+27
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
## [4.12.2](https://github.com/docsifyjs/docsify/compare/v4.12.1...v4.12.2) (2022-01-06)
2+
3+
4+
### Bug Fixes
5+
6+
* Add escapeHtml for search ([#1551](https://github.com/docsifyjs/docsify/issues/1551)) ([c24f7f6](https://github.com/docsifyjs/docsify/commit/c24f7f6f0b87a87f6dd3755f69eb0969ebb029c9))
7+
* allow also " inside of an embed ([ec16e4a](https://github.com/docsifyjs/docsify/commit/ec16e4a9d5718ac4f4c25bb3dcaea3b7551372e0))
8+
* buble theme missing generic fallback font ([#1568](https://github.com/docsifyjs/docsify/issues/1568)) ([37d9f0e](https://github.com/docsifyjs/docsify/commit/37d9f0e1214276e93b2a11ed87390aafa1bdbcec))
9+
* Cannot read property 'classList' of null ([#1527](https://github.com/docsifyjs/docsify/issues/1527)) ([d6df2b8](https://github.com/docsifyjs/docsify/commit/d6df2b85a99371bb9a87402a10dd515bb734182e)), closes [/github.com/docsifyjs/docsify/pull/1527#issuecomment-793455105](https://github.com//github.com/docsifyjs/docsify/pull/1527/issues/issuecomment-793455105)
10+
* Cannot read property 'tagName' of null ([#1655](https://github.com/docsifyjs/docsify/issues/1655)) ([c3cdadc](https://github.com/docsifyjs/docsify/commit/c3cdadc37137edcd9e219359973902d2fc8b66ff)), closes [#1154](https://github.com/docsifyjs/docsify/issues/1154) [/github.com/docsifyjs/docsify/blob/develop/src/core/router/history/html5.js#L25-L27](https://github.com//github.com/docsifyjs/docsify/blob/develop/src/core/router/history/html5.js/issues/L25-L27) [/github.com/docsifyjs/docsify/blob/develop/src/core/router/history/hash.js#L47-L49](https://github.com//github.com/docsifyjs/docsify/blob/develop/src/core/router/history/hash.js/issues/L47-L49)
11+
* upgrade debug from 4.3.2 to 4.3.3 ([#1692](https://github.com/docsifyjs/docsify/issues/1692)) ([40e7749](https://github.com/docsifyjs/docsify/commit/40e77490c68b4143c75dfaebcd0b7f640581306b))
12+
* Upgrade docsify from 4.12.0 to 4.12.1 ([#1544](https://github.com/docsifyjs/docsify/issues/1544)) ([d607f6d](https://github.com/docsifyjs/docsify/commit/d607f6d71c35b50f586806a832f65061f5e3427e))
13+
* upgrade dompurify from 2.2.6 to 2.2.7 ([#1552](https://github.com/docsifyjs/docsify/issues/1552)) ([407e4d4](https://github.com/docsifyjs/docsify/commit/407e4d4f3de78bebd639a3fdae751f8045728e57))
14+
* Upgrade dompurify from 2.2.6 to 2.2.7 ([#1553](https://github.com/docsifyjs/docsify/issues/1553)) ([93c48f3](https://github.com/docsifyjs/docsify/commit/93c48f3d615d95dba550a0e95df6b545d68c3593))
15+
* upgrade dompurify from 2.2.7 to 2.2.8 ([#1577](https://github.com/docsifyjs/docsify/issues/1577)) ([0dd44cc](https://github.com/docsifyjs/docsify/commit/0dd44cc828cc54f7c3b776d45b32925b66cae499))
16+
* upgrade dompurify from 2.2.7 to 2.3.0 ([#1619](https://github.com/docsifyjs/docsify/issues/1619)) ([66303fe](https://github.com/docsifyjs/docsify/commit/66303fec4c7115621e556ad742cfac9d19f26bd9))
17+
* upgrade dompurify from 2.2.8 to 2.2.9 ([#1600](https://github.com/docsifyjs/docsify/issues/1600)) ([baf5a8a](https://github.com/docsifyjs/docsify/commit/baf5a8a4962656d8be8f714283064d2ea10c7e14))
18+
* upgrade dompurify from 2.2.9 to 2.3.0 ([#1616](https://github.com/docsifyjs/docsify/issues/1616)) ([b07fa3c](https://github.com/docsifyjs/docsify/commit/b07fa3cc8323e63dd7b105c7e29b2e1914f5c117))
19+
* upgrade dompurify from 2.3.0 to 2.3.1 ([#1635](https://github.com/docsifyjs/docsify/issues/1635)) ([5ac8237](https://github.com/docsifyjs/docsify/commit/5ac8237cc76e19ca2b373a1a1da6eb4a4da6d8b2))
20+
* upgrade dompurify from 2.3.1 to 2.3.2 ([#1647](https://github.com/docsifyjs/docsify/issues/1647)) ([ff6acfa](https://github.com/docsifyjs/docsify/commit/ff6acfa7623a7db8b00d62c51a9c3037215c4888))
21+
* upgrade node-fetch from 2.6.1 to 2.6.2 ([#1641](https://github.com/docsifyjs/docsify/issues/1641)) ([6ee1c14](https://github.com/docsifyjs/docsify/commit/6ee1c142769a6442aa8c1523ab215106707fa7fc))
22+
* upgrade node-fetch from 2.6.2 to 2.6.4 ([#1649](https://github.com/docsifyjs/docsify/issues/1649)) ([6f81034](https://github.com/docsifyjs/docsify/commit/6f81034ba6a7a6b64ccf1acd2d1fc73761f70a63))
23+
* upgrade node-fetch from 2.6.4 to 2.6.5 ([#1654](https://github.com/docsifyjs/docsify/issues/1654)) ([d16e657](https://github.com/docsifyjs/docsify/commit/d16e657f708777e8377d8e158b50b4010623282d))
24+
* upgrade node-fetch from 2.6.5 to 2.6.6 ([#1668](https://github.com/docsifyjs/docsify/issues/1668)) ([cefe3f8](https://github.com/docsifyjs/docsify/commit/cefe3f87e697a6c54a74d601df2eeb331fcd8933))
25+
26+
27+
128
## [4.12.1](https://github.com/docsifyjs/docsify/compare/v4.12.0...v4.12.1) (2021-03-07)
229

330

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ We welcome any type of contribution, not only code. You can help with
1313

1414
## Your First Contribution
1515

16-
Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github).
16+
Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github).
1717

1818
## Submitting code
1919

@@ -64,4 +64,4 @@ Thank you to all our sponsors! (please ask your company to also support this ope
6464
<a href="https://opencollective.com/docsify/sponsor/8/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/8/avatar.svg"></a>
6565
<a href="https://opencollective.com/docsify/sponsor/9/website" target="_blank"><img src="https://opencollective.com/docsify/sponsor/9/avatar.svg"></a>
6666

67-
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->
67+
<!-- This `CONTRIBUTING.md` is based on @nayafia's template https://github.com/nayafia/contributing-template -->

Dockerfile

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM mcr.microsoft.com/playwright:focal
2+
WORKDIR /app
3+
COPY . .
4+
RUN rm package-lock.json
5+
RUN npm install
6+
RUN npx playwright install
7+
RUN npm run build
8+
ENTRYPOINT ["npm", "run"]
9+
CMD ["test"]

LICENSE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 - present cinwell.li
3+
Copyright (c) 2016 - present Docsify Contributors (https://github.com/docsifyjs/docsify/graphs/contributors)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

+5-9
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@
1212
<a href="#backers"><img alt="Backers on Open Collective" src="https://opencollective.com/docsify/backers/badge.svg?style=flat-square"></a>
1313
<a href="#sponsors">
1414
<img alt="Sponsors on Open Collective" src="https://opencollective.com/docsify/sponsors/badge.svg?style=flat-square"></a>
15-
<a><img src="https://github.com/docsifyjs/docsify/workflows/Unit%20tests%20Suite/badge.svg?branch=develop&amp;event=push" alt="Unit tests Suite"></a>
16-
<a><img src="https://github.com/docsifyjs/docsify/workflows/Linting%20Checks/badge.svg?branch=develop&amp;event=push" alt="Linting Checks"></a>
17-
<a><img src="https://github.com/docsifyjs/docsify/workflows/Testing%20the%20e2e%20test%20suites/badge.svg?branch=develop&amp;event=push" alt="Testing the e2e test suites"></a>
15+
<a href="https://github.com/docsifyjs/docsify/actions/workflows/test.yml"><img src="https://github.com/docsifyjs/docsify/actions/workflows/test.yml/badge.svg" alt="Build & Test"></a>
1816
<a href="https://www.npmjs.com/package/docsify"><img alt="npm" src="https://img.shields.io/npm/v/docsify.svg?style=flat-square"></a>
1917
<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>
2018
<a href="https://discord.gg/3NwKFyR"><img alt="Join Discord community and chat about Docsify" src="https://img.shields.io/discord/713647066802421792.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2&cacheSeconds=60"></a>
@@ -31,7 +29,7 @@
3129

3230
## Links
3331

34-
- [`develop` branch preview](https://docsifyjs.netlify.com/)
32+
- [`develop` branch preview](https://docsify-preview.vercel.app/)
3533
- [Documentation](https://docsify.js.org)
3634
- [CLI](https://github.com/docsifyjs/docsify-cli)
3735
- CDN: [UNPKG](https://unpkg.com/docsify/) | [jsDelivr](https://cdn.jsdelivr.net/npm/docsify/) | [cdnjs](https://cdnjs.com/libraries/docsify)
@@ -46,7 +44,7 @@
4644
- Multiple themes
4745
- Useful plugin API
4846
- Compatible with IE11
49-
- Support SSR ([example](https://github.com/docsifyjs/docsify-ssr-demo))
47+
- Experimental SSR support ([example](https://github.com/docsifyjs/docsify-ssr-demo))
5048
- Support embedded files
5149

5250
## Quick start
@@ -72,7 +70,7 @@ Move to [awesome-docsify](https://github.com/docsifyjs/awesome-docsify#showcase)
7270

7371
### Online one-click setup for Contributing
7472

75-
You can use Gitpod(A free online VS Code-like IDE) for contributing. With single click it'll launch a workspace and automatically:
73+
You can use Gitpod (a free online VS Code-like IDE) for contributing. With a single click it'll launch a workspace and automatically:
7674

7775
- clone the docsify repo.
7876
- install the dependencies.
@@ -126,6 +124,4 @@ This project exists thanks to all the people who contribute. [[Contribute](CONTR
126124

127125
## Special Thanks
128126

129-
_Vercel_ has given us a Pro account.
130-
131-
<a href="https://vercel.com/?utm_source=docsifyjsdocs" target="_blank"><img src="docs/_media/vercel_logo.svg" width="100px"></a>
127+
A preview of Docsify's PR and develop branch is <a href="https://vercel.com/?utm_source=docsifyjs&utm_campaign=oss" target="_blank">Powered by <img src="https://cdn.jsdelivr.net/gh/docsifyjs/docsify/docs/_media/vercel_logo.svg" alt="Vercel" width="133px"></a>

0 commit comments

Comments
 (0)