Skip to content

Commit 6ed4bb1

Browse files
committed
fix: search does not find the contents of the table
1 parent 1a09ce3 commit 6ed4bb1

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Diff for: src/plugins/search/search.js

+14-8
Original file line numberDiff line numberDiff line change
@@ -84,16 +84,22 @@ export function genIndex(path, content = '', router, depth) {
8484
if (!index[slug]) {
8585
index[slug] = { slug, title: '', body: '' };
8686
} else if (index[slug].body) {
87+
if (!token.text && token.type === 'table') {
88+
token.text = token.cells
89+
.map(function(rows) {
90+
return rows.join(' | ');
91+
})
92+
.join(' |\n ');
93+
}
94+
8795
index[slug].body += '\n' + (token.text || '');
8896
} else {
89-
if (!token.text) {
90-
if (token.type === 'table') {
91-
token.text = token.cells
92-
.map(function(rows) {
93-
return rows.join(' | ');
94-
})
95-
.join(' |\n ');
96-
}
97+
if (!token.text && token.type === 'table') {
98+
token.text = token.cells
99+
.map(function(rows) {
100+
return rows.join(' | ');
101+
})
102+
.join(' |\n ');
97103
}
98104

99105
index[slug].body = index[slug].body

0 commit comments

Comments
 (0)