From ce316075e033afdbeb43ce01e284a29fe1870e38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=B2=88=E5=94=81?= <52o@qq52o.cn>
Date: Sat, 22 Aug 2020 19:24:56 +0800
Subject: [PATCH 1/4] fix : add patch for {docsify-ignore} and
{docsify-ignore-all} (#1351)
* revert: Convert {docsify-ignore} and {docsify-ignore-all} to HTML comments
This reverts commit 90d283d340502456a5d8495df596bb4a02ceb39b
* fix: patch for docsify-ignore
* fix test
* fix test
---
src/core/render/compiler.js | 12 ++++++++
src/core/render/compiler/headline.js | 12 ++++++++
test/unit/render.test.js | 43 +++++++++++++++++++++++++---
3 files changed, 63 insertions(+), 4 deletions(-)
diff --git a/src/core/render/compiler.js b/src/core/render/compiler.js
index 669b6226f..2978a9f26 100644
--- a/src/core/render/compiler.js
+++ b/src/core/render/compiler.js
@@ -214,12 +214,24 @@ export class Compiler {
nextToc.ignoreSubHeading = true;
}
+ if (/{docsify-ignore}/g.test(str)) {
+ str = str.replace('{docsify-ignore}', '');
+ nextToc.title = str;
+ nextToc.ignoreSubHeading = true;
+ }
+
if (//g.test(str)) {
str = str.replace('', '');
nextToc.title = str;
nextToc.ignoreAllSubs = true;
}
+ if (/{docsify-ignore-all}/g.test(str)) {
+ str = str.replace('{docsify-ignore-all}', '');
+ nextToc.title = str;
+ nextToc.ignoreAllSubs = true;
+ }
+
const slug = slugify(config.id || str);
const url = router.toURL(router.getCurrentPath(), { id: slug });
nextToc.slug = url;
diff --git a/src/core/render/compiler/headline.js b/src/core/render/compiler/headline.js
index cfbad7b25..48ae9e8c9 100644
--- a/src/core/render/compiler/headline.js
+++ b/src/core/render/compiler/headline.js
@@ -12,12 +12,24 @@ export const headingCompiler = ({ renderer, router, _self }) =>
nextToc.ignoreSubHeading = true;
}
+ if (/{docsify-ignore}/g.test(str)) {
+ str = str.replace('{docsify-ignore}', '');
+ nextToc.title = str;
+ nextToc.ignoreSubHeading = true;
+ }
+
if (//g.test(str)) {
str = str.replace('', '');
nextToc.title = str;
nextToc.ignoreAllSubs = true;
}
+ if (/{docsify-ignore-all}/g.test(str)) {
+ str = str.replace('{docsify-ignore-all}', '');
+ nextToc.title = str;
+ nextToc.ignoreAllSubs = true;
+ }
+
const slug = slugify(config.id || str);
const url = router.toURL(router.getCurrentPath(), { id: slug });
nextToc.slug = url;
diff --git a/test/unit/render.test.js b/test/unit/render.test.js
index 43a87248d..fe5bade7f 100644
--- a/test/unit/render.test.js
+++ b/test/unit/render.test.js
@@ -254,9 +254,7 @@ describe('render', function() {
it('ignore', async function() {
const { docsify } = await init();
- const output = docsify.compiler.compile(
- '## h2 tag '
- );
+ const output = docsify.compiler.compile('## h2 tag {docsify-ignore}');
expectSameDom(
output,
`
@@ -268,10 +266,26 @@ describe('render', function() {
);
});
+ it('ignore-html-comments', async function() {
+ const { docsify } = await init();
+ const output = docsify.compiler.compile(
+ '## h2 tag ignore '
+ );
+ expectSameDom(
+ output,
+ `
+
`
+ );
+ });
+
it('ignore-all', async function() {
const { docsify } = await init();
const output = docsify.compiler.compile(
- `# h1 tag ` + `\n## h2 tag`
+ `# h1 tag {docsify-ignore-all}` + `\n## h2 tag`
);
expectSameDom(
output,
@@ -288,6 +302,27 @@ describe('render', function() {
`
);
});
+
+ it('ignore-all-html-comments', async function() {
+ const { docsify } = await init();
+ const output = docsify.compiler.compile(
+ `# h1 tag ignore ` + `\n## h2 tag`
+ );
+ expectSameDom(
+ output,
+ `
+
+ `
+ );
+ });
});
describe('link', function() {
From 238dada7a5011b5b3b7cda327557d1bc5ad10b6d Mon Sep 17 00:00:00 2001
From: sy-records <52o@qq52o.cn>
Date: Sat, 22 Aug 2020 19:37:00 +0800
Subject: [PATCH 2/4] [build] 4.11.6
---
docs/_coverpage.md | 2 +-
packages/docsify-server-renderer/package-lock.json | 2 +-
packages/docsify-server-renderer/package.json | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/docs/_coverpage.md b/docs/_coverpage.md
index 51db8d2e9..557c5aa6b 100644
--- a/docs/_coverpage.md
+++ b/docs/_coverpage.md
@@ -1,6 +1,6 @@
![logo](_media/icon.svg)
-# docsify 4.11.5
+# docsify 4.11.6
> A magical documentation site generator.
diff --git a/packages/docsify-server-renderer/package-lock.json b/packages/docsify-server-renderer/package-lock.json
index 12811bd6b..a73c213e6 100644
--- a/packages/docsify-server-renderer/package-lock.json
+++ b/packages/docsify-server-renderer/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
- "version": "4.11.5",
+ "version": "4.11.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/docsify-server-renderer/package.json b/packages/docsify-server-renderer/package.json
index 9075a03f4..12ce74d05 100644
--- a/packages/docsify-server-renderer/package.json
+++ b/packages/docsify-server-renderer/package.json
@@ -1,6 +1,6 @@
{
"name": "docsify-server-renderer",
- "version": "4.11.5",
+ "version": "4.11.6",
"description": "docsify server renderer",
"author": {
"name": "qingwei-li",
From d3482aca465d612fcc80e122a0bdd153232da645 Mon Sep 17 00:00:00 2001
From: sy-records <52o@qq52o.cn>
Date: Sat, 22 Aug 2020 19:37:04 +0800
Subject: [PATCH 3/4] chore: add changelog 4.11.6
---
CHANGELOG.md | 4 ++++
package-lock.json | 2 +-
package.json | 2 +-
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index facd1fe95..1d7af54f8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## [4.11.6](https://github.com/docsifyjs/docsify/compare/v4.11.5...v4.11.6) (2020-08-22)
+
+
+
## [4.11.5](https://github.com/docsifyjs/docsify/compare/v4.11.4...v4.11.5) (2020-08-21)
diff --git a/package-lock.json b/package-lock.json
index 6cd171362..70f993883 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "docsify",
- "version": "4.11.5",
+ "version": "4.11.6",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/package.json b/package.json
index 77dc42fdc..0e55d1f28 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "docsify",
- "version": "4.11.5",
+ "version": "4.11.6",
"description": "A magical documentation generator.",
"author": {
"name": "qingwei-li",
From 7580dc4185497823fb8cb4e75464458743c80fd5 Mon Sep 17 00:00:00 2001
From: sy-records <52o@qq52o.cn>
Date: Sat, 22 Aug 2020 19:42:40 +0800
Subject: [PATCH 4/4] chore: update changelog 4.11.6
---
CHANGELOG.md | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1d7af54f8..14afb19af 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,11 @@
## [4.11.6](https://github.com/docsifyjs/docsify/compare/v4.11.5...v4.11.6) (2020-08-22)
+### Bug Fixes
+
+* Add patch for {docsify-ignore} and {docsify-ignore-all} ([ce31607](https://github.com/docsifyjs/docsify/commit/ce316075e033afdbeb43ce01e284a29fe1870e38))
+
+
## [4.11.5](https://github.com/docsifyjs/docsify/compare/v4.11.4...v4.11.5) (2020-08-21)
@@ -90,8 +95,8 @@
* emojis in titles not working correctly and update ([#1016](https://github.com/docsifyjs/docsify/issues/1016)) ([b3d9b96](https://github.com/docsifyjs/docsify/commit/b3d9b966dfbb6f456c2c457da1d2a366e85d9190))
* searching table content ([6184e50](https://github.com/docsifyjs/docsify/commit/6184e502629932ca71fdd0a1b10150d118f5a7c8))
* stage modified files as part of pre-commit hook ([#985](https://github.com/docsifyjs/docsify/issues/985)) ([5b77b0f](https://github.com/docsifyjs/docsify/commit/5b77b0f628f056b7ebb6d0b617561d19964516a2))
-* config initialization and coercion ([#861](https://github.com/docsifyjs/docsify/pull/861))
-* strip indent when embedding code fragment ([#996](https://github.com/docsifyjs/docsify/pull/996))
+* config initialization and coercion ([#861](https://github.com/docsifyjs/docsify/pull/861))
+* strip indent when embedding code fragment ([#996](https://github.com/docsifyjs/docsify/pull/996))
* Ensure autoHeader dom result is similar to parsed H1 ([#811](https://github.com/docsifyjs/docsify/pull/811))
* upgrade docsify from 4.9.4 to 4.10.2 ([#1054](https://github.com/docsifyjs/docsify/issues/1054)) ([78290b2](https://github.com/docsifyjs/docsify/commit/78290b21038a3ae09c4c7438bd89b14ca4c02805))
* upgrade medium-zoom from 1.0.4 to 1.0.5 ([39ebd73](https://github.com/docsifyjs/docsify/commit/39ebd73021290439180878cae32e663b9e60e214))
@@ -110,7 +115,7 @@
### Docs
-* update docs for the `name` config option ([#992](https://github.com/docsifyjs/docsify/pull/992))
+* update docs for the `name` config option ([#992](https://github.com/docsifyjs/docsify/pull/992))
* about cache ([#854](https://github.com/docsifyjs/docsify/pull/854))
* removed FOSSA badge
* documented `__colon__` tip ([#1025](https://github.com/docsifyjs/docsify/pull/1025))
@@ -118,21 +123,21 @@
### Chore
* Migrate relative links to absolute in embedded markdown ([#867](https://github.com/docsifyjs/docsify/pull/867))
-* smarter scroll behavior ([#744](https://github.com/docsifyjs/docsify/pull/744))
+* smarter scroll behavior ([#744](https://github.com/docsifyjs/docsify/pull/744))
* improve basic layout style ([#884](https://github.com/docsifyjs/docsify/pull/884))
-* There are currently {three=>four} themes available. ([#892](https://github.com/docsifyjs/docsify/pull/892))
-* Added a redirect for images to show up in Amplify ([#918](https://github.com/docsifyjs/docsify/pull/918))
+* There are currently {three=>four} themes available. ([#892](https://github.com/docsifyjs/docsify/pull/892))
+* Added a redirect for images to show up in Amplify ([#918](https://github.com/docsifyjs/docsify/pull/918))
* removed the escaping of the name of sidebar ([#991](https://github.com/docsifyjs/docsify/pull/991))
-* Eslint fixes for v4x ([#989](https://github.com/docsifyjs/docsify/pull/989))
-* added github Actions for CI ([#1000](https://github.com/docsifyjs/docsify/pull/1000))
+* Eslint fixes for v4x ([#989](https://github.com/docsifyjs/docsify/pull/989))
+* added github Actions for CI ([#1000](https://github.com/docsifyjs/docsify/pull/1000))
* Add a prepare script. ([#1010](https://github.com/docsifyjs/docsify/pull/1010))
-* chore(GH-action): using ubuntu 16 and removed node 8 from CI
+* chore(GH-action): using ubuntu 16 and removed node 8 from CI
* chore: add config ([#1014](https://github.com/docsifyjs/docsify/pull/1014))
* chore(stale): added enhancement label to exemptlabels
* chore(stale): added bug label to exemptlabels
-* .markdown-section max-width 800px to 80% ([#1017](https://github.com/docsifyjs/docsify/pull/1017))
-* changed the CDN from unpkg to jsDelivr #1020 ([#1022](https://github.com/docsifyjs/docsify/pull/1022))
-* migrate CI to github, refactore CI and npm scripts, linting fixes ([#1023](https://github.com/docsifyjs/docsify/pull/1023))
+* .markdown-section max-width 800px to 80% ([#1017](https://github.com/docsifyjs/docsify/pull/1017))
+* changed the CDN from unpkg to jsDelivr #1020 ([#1022](https://github.com/docsifyjs/docsify/pull/1022))
+* migrate CI to github, refactore CI and npm scripts, linting fixes ([#1023](https://github.com/docsifyjs/docsify/pull/1023))
* chore(readme): added CI badges and fixed the logo issue
* added new linter config ([#1028](https://github.com/docsifyjs/docsify/pull/1028))