MCPcopy
hub / github.com/marktext/marktext / search

Function search

packages/muya/src/utils/prism/index.ts:41–51  ·  view source on GitHub ↗
(text: string)

Source from the content-addressed store, hash-verified

39const loadLanguage = initLoadLanguage(Prism);
40
41function 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`
54loadLanguage('latex');

Callers 1

listenMethod · 0.90

Calls 2

mapMethod · 0.45
searchMethod · 0.45

Tested by

no test coverage detected