(text: string)
| 39 | const loadLanguage = initLoadLanguage(Prism); |
| 40 | |
| 41 | function search(text: string) { |
| 42 | if (!text || typeof text !== 'string') |
| 43 | return []; |
| 44 | |
| 45 | const fuse = new Fuse(langs, { |
| 46 | includeScore: true, |
| 47 | keys: ['name', 'title', 'alias'], |
| 48 | }); |
| 49 | |
| 50 | return fuse.search(text).map(i => i.item).slice(0, 5); |
| 51 | } |
| 52 | |
| 53 | // pre load latex and yaml and html for `math block` \ `front matter` and `html block` |
| 54 | loadLanguage('latex'); |