File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed
packages/docs/src/components/docsearch Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -20,9 +20,18 @@ interface SnippetProps<TItem> {
20
20
21
21
export const Snippet = component$ (
22
22
( { hit, attribute, tagName = 'span' , ...rest } : SnippetProps < any > ) => {
23
- const data =
23
+ let data =
24
24
getPropertyByPath ( hit , `_snippetResult.${ attribute ?? `hierarchy.${ hit . type } ` } .value` ) ||
25
- getPropertyByPath ( hit , attribute ?? `hierarchy.${ hit . type } ` ) ;
25
+ getPropertyByPath ( hit , attribute ?? `hierarchy.${ hit . type } ` ) ||
26
+ getPropertyByPath ( hit , 'hierarchy.lvl0' ) + ' ' + getPropertyByPath ( hit , 'hierarchy.lvl2' ) ;
27
+
28
+ const cleanedData = data . replace ( '<mark>' , '' ) . replace ( '</mark>' , '' ) . toLowerCase ( ) ;
29
+ if ( cleanedData === 'runtime-less' ) {
30
+ const paths = hit . url . split ( '/' ) ;
31
+ paths . pop ( ) ;
32
+ data = `example: ${ paths . pop ( ) } ` ;
33
+ }
34
+
26
35
return < span { ...rest } dangerouslySetInnerHTML = { data } /> ;
27
36
}
28
37
) ;
You can’t perform that action at this time.
0 commit comments