How to return highlight as an html instead of string?

So I have a problem , I created a custom highlight like so:

customHighlight={() => ({

                                           highlight: {

                                                pre_tags: ['<mark>'],

                                                post_tags: ['</mark>'],

                                                fields: {

                                                    text: {},

                                                    title: {},


                                                number_of_fragments: 0,



However, my search results return this

<mark>Blast</mark> from the past

Why is this not returned as HTML, but rather as a string?

Hi Nikola,

If you mean why doesn't it have <!DOCTYPE html><html lang="en"> at the top it's because the assumption is an HTML snippet for embedding in a page is considered more useful than a page.
We typically return multiple results so snippets make more sense. We make no guarantees about what original text we highlight either e.g. if it's full of naughty <script>.... tags.
This cleansing/formatting is your app's responsibility.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.