mirror of
https://github.com/docsifyjs/docsify.git
synced 2025-12-08 19:55:52 +00:00
parent
fac7ce693f
commit
3476f6ff1f
@ -65,14 +65,22 @@ export function genIndex (path, content = '', router, depth) {
|
||||
return index
|
||||
}
|
||||
|
||||
export function search (keywords) {
|
||||
/**
|
||||
* @param {String} query
|
||||
* @returns {Array}
|
||||
*/
|
||||
export function search (query) {
|
||||
const matchingResults = []
|
||||
let data = []
|
||||
Object.keys(INDEXS).forEach(key => {
|
||||
data = data.concat(Object.keys(INDEXS[key]).map(page => INDEXS[key][page]))
|
||||
})
|
||||
|
||||
keywords = [].concat(keywords, keywords.trim().split(/[\s\-\,\\/]+/))
|
||||
query = query.trim()
|
||||
let keywords = query.split(/[\s\-\,\\/]+/)
|
||||
if (keywords.length !== 1) {
|
||||
keywords = [].concat(query, keywords)
|
||||
}
|
||||
|
||||
for (let i = 0; i < data.length; i++) {
|
||||
const post = data[i]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user