File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 1
- import { html } from 'htm/preact' ;
2
1
import algoliasearch from 'algoliasearch/lite' ;
3
2
import { autocomplete , getAlgoliaResults } from '@algolia/autocomplete-js' ;
4
3
import { createAlgoliaInsightsPlugin } from '@algolia/autocomplete-plugin-algolia-insights' ;
@@ -55,17 +54,20 @@ function initAutocomplete(item){
55
54
} ) ;
56
55
} ,
57
56
templates : {
58
- item ( { item } ) {
57
+ item ( { item, createElement } ) {
59
58
if ( item . anchor != null ) {
60
59
var anchorLink = "#" + item . anchor ;
61
60
} else {
62
61
var anchorLink = "" ;
63
62
}
64
- return html `< a class ="aa-link " href ="/docs ${ item . url } ${ anchorLink } ">
65
- < p class ="aa-title " > ${ highlightHit ( { hit : item , attribute : 'title' } ) } </ h3 >
66
- < p class ="aa-heading "> ${ item . headings . join ( ' >' ) } </ p >
67
- < p class ="aa-content "> ${ highlightHit ( { hit : item , attribute : 'content' } ) } </ p > </ a >
68
- ` ;
63
+ return createElement ( 'div' , {
64
+ dangerouslySetInnerHTML : {
65
+ __html : `<a class="aa-link" href="/docs${ item . url } ${ anchorLink } ">
66
+ <p class="aa-title" >${ highlightHit ( { hit : item , attribute : 'title' } ) } </h3>
67
+ <p class="aa-heading">${ item . headings . join ( ' >' ) } </p>
68
+ <p class="aa-content">${ highlightHit ( { hit : item , attribute : 'content' } ) } </p></a>`
69
+ }
70
+ } )
69
71
} ,
70
72
noResults ( ) {
71
73
return html `< p class ="aa-content "> No results for < strong > ${ query } </ strong > </ p > ` ;
You can’t perform that action at this time.
0 commit comments