bump: 3.1
This commit is contained in:
parent
b8a3d8f380
commit
490a2cd64e
7 changed files with 178 additions and 13 deletions
|
|
@ -46,13 +46,14 @@ function genIndex (path, content) {
|
|||
if ( content === void 0 ) content = '';
|
||||
|
||||
var tokens = window.marked.lexer(content);
|
||||
var slugify = window.Docsify.slugify;
|
||||
var toURL = Docsify.route.toURL;
|
||||
var index = {};
|
||||
var slug;
|
||||
|
||||
tokens.forEach(function (token) {
|
||||
if (token.type === 'heading' && token.depth <= 2) {
|
||||
slug = toURL(path, { id: token.text });
|
||||
slug = toURL(path, { id: slugify(token.text) });
|
||||
index[slug] = { slug: slug, title: token.text, body: '' };
|
||||
} else {
|
||||
if (!slug) { return }
|
||||
|
|
@ -67,7 +68,7 @@ function genIndex (path, content) {
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
slugify.clear();
|
||||
return index
|
||||
}
|
||||
|
||||
|
|
@ -215,7 +216,7 @@ function bindEvents () {
|
|||
function (e) { return e.target.tagName !== 'A' && e.stopPropagation(); });
|
||||
dom.on($input, 'input', function (e) {
|
||||
clearTimeout(timeId);
|
||||
timeId = setTimeout(function (_) { return doSearch(e.target.value.trim()); }, 200);
|
||||
timeId = setTimeout(function (_) { return doSearch(e.target.value.trim()); }, 100);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue