Skip to content

Commit d3163b3

Browse files
committed
fix: search cannot search list content
1 parent 2100fc3 commit d3163b3

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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)