Skip to content

Commit

Permalink
fix: searching table content
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records authored Feb 7, 2020
1 parent 90a35ab commit 6184e50
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/plugins/search/search.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,15 @@ export function genIndex(path, content = '', router, depth) {
} else if (index[slug].body) {
index[slug].body += '\n' + (token.text || '')
} else {
index[slug].body = token.text
if (!token.text) {
if (token.type === 'table') {
token.text = token.cells.map(function (rows) {
return rows.join(' | ')
}).join(' |\n ')
}
}

index[slug].body = (index[slug].body ? index[slug].body + token.text : token.text)
}
}
})
Expand Down

0 comments on commit 6184e50

Please sign in to comment.