@@ -210,8 +210,8 @@ export interface VersionFilterData {
210210 // filter for matches and store them
211211 allItems
212212 .map(item => ({
213- item,
214- score: scoreSearchMatch(item, queryLower)
213+ item: item ,
214+ score: scoreSearchMatch(item, queryLower),
215215 }))
216216 .filter(s => s.score !== 0)
217217 .forEach(s => searchCache.set(s.item.syntaxId, s.score))
@@ -244,8 +244,16 @@ export interface VersionFilterData {
244244 let score = 0;
245245 const element = item.element;
246246
247- // Weigh ID
247+ // Handle exact ID lookup
248248 const id = item.syntaxId.toLowerCase();
249+ if (searchLower[0] === '#') {
250+ if (`#${id}` === searchLower) {
251+ return Number.MAX_SAFE_INTEGER;
252+ }
253+ return 0;
254+ }
255+
256+ // Weigh ID
249257 if (id === searchLower) { // Exact match on syntax ID, immediately return
250258 return Number.MAX_SAFE_INTEGER;
251259 }
@@ -514,8 +522,9 @@ export interface VersionFilterData {
514522 }
515523 event.preventDefault();
516524 if ((event.target.closest('.documentation-card') as HTMLElement)?.dataset.syntaxId === hash) { // copying link to card
517- url.search = ''; // remove search from URL for linking
518- url.hash = hash;
525+ url.search = '';
526+ url.searchParams.set('search', '#' + hash);
527+ url.hash = '';
519528 navigator.clipboard.writeText(url.href).then(() => {
520529 // TODO some sort of popup notifying link copied
521530 });
0 commit comments