Skip to content

Commit 6184e50

Browse files
authored
fix: searching table content
1 parent 90a35ab commit 6184e50

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/plugins/search/search.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ export function genIndex(path, content = '', router, depth) {
7171
} else if (index[slug].body) {
7272
index[slug].body += '\n' + (token.text || '')
7373
} else {
74-
index[slug].body = token.text
74+
if (!token.text) {
75+
if (token.type === 'table') {
76+
token.text = token.cells.map(function (rows) {
77+
return rows.join(' | ')
78+
}).join(' |\n ')
79+
}
80+
}
81+
82+
index[slug].body = (index[slug].body ? index[slug].body + token.text : token.text)
7583
}
7684
}
7785
})

0 commit comments

Comments
 (0)