Skip to content

Commit

Permalink
fix search
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed May 27, 2020
1 parent 1a09ce3 commit 3a740c8
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,16 +84,22 @@ export function genIndex(path, content = '', router, depth) {
if (!index[slug]) {
index[slug] = { slug, title: '', body: '' };
} else if (index[slug].body) {
if (!token.text && token.type === 'table') {
token.text = token.cells
.map(function(rows) {
return rows.join(' | ');
})
.join(' |\n ');
}

index[slug].body += '\n' + (token.text || '');
} else {
if (!token.text) {
if (token.type === 'table') {
token.text = token.cells
.map(function(rows) {
return rows.join(' | ');
})
.join(' |\n ');
}
if (!token.text && token.type === 'table') {
token.text = token.cells
.map(function(rows) {
return rows.join(' | ');
})
.join(' |\n ');
}

index[slug].body = index[slug].body
Expand Down

0 comments on commit 3a740c8

Please sign in to comment.