Skip to content

Commit 3cca7cb

Browse files
authored
Merge branch 'develop' into fix/embed-multiple
2 parents d51044d + c2d12ed commit 3cca7cb

File tree

4 files changed

+45
-19
lines changed

4 files changed

+45
-19
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
context('sidebar.search', () => {
2+
beforeEach(() => {
3+
cy.visit('http://localhost:3000');
4+
});
5+
6+
it('search list',()=>{
7+
cy.get(':input[type=search]')
8+
9+
.type("npm i -g now")
10+
11+
.should('have.value', 'npm i -g now');
12+
13+
cy.get(
14+
'.results-panel>.matching-post p>em'
15+
). should('contain', 'npm i -g now');
16+
})
17+
});

packages/docsify-server-renderer/package-lock.json

Lines changed: 18 additions & 18 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/docsify-server-renderer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
},
1717
"dependencies": {
1818
"debug": "^4.1.1",
19-
"docsify": "^4.11.4",
19+
"docsify": "^4.11.6",
2020
"dompurify": "^2.0.8",
2121
"node-fetch": "^2.6.0",
2222
"resolve-pathname": "^3.0.0"

src/plugins/search/search.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,13 @@ function getTableData(token) {
6666
return token.text;
6767
}
6868

69+
function getListData(token) {
70+
if (!token.text && token.type === 'list') {
71+
token.text = token.raw;
72+
}
73+
return token.text;
74+
}
75+
6976
function saveData(maxAge, expireKey, indexKey) {
7077
localStorage.setItem(expireKey, Date.now() + maxAge);
7178
localStorage.setItem(indexKey, JSON.stringify(INDEXS));
@@ -97,10 +104,12 @@ export function genIndex(path, content = '', router, depth) {
97104
index[slug] = { slug, title: '', body: '' };
98105
} else if (index[slug].body) {
99106
token.text = getTableData(token);
107+
token.text = getListData(token);
100108

101109
index[slug].body += '\n' + (token.text || '');
102110
} else {
103111
token.text = getTableData(token);
112+
token.text = getListData(token);
104113

105114
index[slug].body = index[slug].body
106115
? index[slug].body + token.text

0 commit comments

Comments
 (0)