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' ;
21import algoliasearch from 'algoliasearch/lite' ;
32import { autocomplete , getAlgoliaResults } from '@algolia/autocomplete-js' ;
43import { createAlgoliaInsightsPlugin } from '@algolia/autocomplete-plugin-algolia-insights' ;
@@ -55,17 +54,20 @@ function initAutocomplete(item){
5554 } ) ;
5655 } ,
5756 templates : {
58- item ( { item } ) {
57+ item ( { item, createElement } ) {
5958 if ( item . anchor != null ) {
6059 var anchorLink = "#" + item . anchor ;
6160 } else {
6261 var anchorLink = "" ;
6362 }
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+ } )
6971 } ,
7072 noResults ( ) {
7173 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