diff --git a/completions.js b/completions.js index b7e2a41..0a1a770 100644 --- a/completions.js +++ b/completions.js @@ -991,24 +991,14 @@ completions.md = { completions.md.callback = (response) => { const res = JSON.parse(response.text) - return res.documents.map((s) => { - let excerpt = escape(s.excerpt) - if (excerpt.length > 240) { - excerpt = `${excerpt.slice(0, 240)}…` - } - res.query.split(" ").forEach((q) => { - excerpt = excerpt.replace(new RegExp(q, "gi"), "$&") - }) - const title = escape(s.title) - const slug = escape(s.slug) - return createSuggestionItem(` + return res.documents.map((s) => + createSuggestionItem(`
-
${title}
-
${slug}
-
${excerpt}
+
${s.title}
+
${s.slug}
+
${s.summary}
- `, { url: `https://developer.mozilla.org/${s.locale}/docs/${s.slug}` }) - }) + `, { url: `https://developer.mozilla.org/${s.locale}/docs/${s.slug}` })) } // NPM registry search diff --git a/util.js b/util.js index 9e9fedc..070d18b 100644 --- a/util.js +++ b/util.js @@ -133,7 +133,7 @@ util.processMaps = (maps, aliases, siteleader) => { const fullDescription = `#${category} ${description}` - if (mapObj.map !== undefined) { + if (typeof mapObj.map !== "undefined") { map(alias, mapObj.map) } else { mapkey(key, fullDescription, callback, opts)