Skip to content

Fix rendering and highlighting issue in search result preview

Soroush Jahanzad requested to merge fix-search-preview-rendering into master

This request changes the highlighting procedure to use a recursive approach instead of trying to match words with the object's content after converting it to one single string.

Merging this request fixes the markdown rendering issue #338 where [object Object] is displayed instead of formatted text. The highlighting also works better, as the regex check goes deeper inside nested elements instead of trying to find matches only on the (possibly wrongly) converted string of the whole result. Highlighting for headings is also added.

In addition, potentially solves #307 as it takes care of the case where matches is empty, and that case no longer leads to the site being frozen.

As an example, after searching for "Widerspruch-Beweis: Angenommen" on current production, it leads to the following result.

image

In this merge request, searching for the same query results in the following image.

image

Edited by Soroush Jahanzad

Merge request reports

Loading