Skip to content

Commit a0b11b5

Browse files
committed
fix: reset #1318
1 parent e474ea8 commit a0b11b5

File tree

4 files changed

+13
-50
lines changed

4 files changed

+13
-50
lines changed

docs/more-pages.md

Lines changed: 5 additions & 5 deletions
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.

src/core/render/compiler.js

Lines changed: 4 additions & 4 deletions
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
}

src/core/render/compiler/headline.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ export const headingCompiler = ({ renderer, router, _self }) =>
66
let { str, config } = getAndRemoveConfig(text);
77
const nextToc = { level, title: str };
88

9-
if (/<!-- {docsify-ignore} -->/g.test(str)) {
10-
str = str.replace('<!-- {docsify-ignore} -->', '');
9+
if (/{docsify-ignore}/g.test(str)) {
10+
str = str.replace('{docsify-ignore}', '');
1111
nextToc.title = str;
1212
nextToc.ignoreSubHeading = true;
1313
}
1414

15-
if (/<!-- {docsify-ignore-all} -->/g.test(str)) {
16-
str = str.replace('<!-- {docsify-ignore-all} -->', '');
15+
if (/{docsify-ignore-all}/g.test(str)) {
16+
str = str.replace('{docsify-ignore-all}', '');
1717
nextToc.title = str;
1818
nextToc.ignoreAllSubs = true;
1919
}

test/unit/render.test.js

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -251,43 +251,6 @@ describe('render', function() {
251251
</h6>`
252252
);
253253
});
254-
255-
it('ignore', async function() {
256-
const { docsify } = await init();
257-
const output = docsify.compiler.compile(
258-
'## h2 tag <!-- {docsify-ignore} -->'
259-
);
260-
expectSameDom(
261-
output,
262-
`
263-
<h2 id="h2-tag">
264-
<a href="#/?id=h2-tag" data-id="h2-tag" class="anchor">
265-
<span>h2 tag </span>
266-
</a>
267-
</h2>`
268-
);
269-
});
270-
271-
it('ignore-all', async function() {
272-
const { docsify } = await init();
273-
const output = docsify.compiler.compile(
274-
`# h1 tag <!-- {docsify-ignore-all} -->` + `\n## h2 tag`
275-
);
276-
expectSameDom(
277-
output,
278-
`
279-
<h1 id="h1-tag">
280-
<a href="#/?id=h1-tag" data-id="h1-tag" class="anchor">
281-
<span>h1 tag </span>
282-
</a>
283-
</h1>
284-
<h2 id="h2-tag">
285-
<a href="#/?id=h2-tag" data-id="h2-tag" class="anchor">
286-
<span>h2 tag</span>
287-
</a>
288-
</h2>`
289-
);
290-
});
291254
});
292255

293256
describe('link', function() {

0 commit comments

Comments
 (0)