Topic on Project:Support desk

Captgoodhope (talkcontribs)

Hello there

Is there a way to highlight the search hits in the matching documents? The search terms are bold faced in the search results page, but I'd like to see the terms highlighted or bold faced when the documents are opened. DokuWiki does this by default. I tried enabling $wgAdvancedSearchHighlighting but don't see any difference at all with that setting.

Thank you

AhmadF.Cheema (talkcontribs)

You can use CSS to make the desired customisations. In your MediaWiki:Common.css page, use something like the following:

/* Search result headings */
div.mw-search-result-heading {
	background-color: #ffeb3b85;
}
/* Search result content */
div.searchresult {
	background-color: #8bc34a63;
}
Captgoodhope (talkcontribs)
AhmadF.Cheema (talkcontribs)

Someone asked about such functionality three years ago too. Don't think this is natively possible, will probably require some JavaScript.

$wgAdvancedSearchHighlighting appears to be broken. Although it does appear to have some effect on the amount of wikitext shown in the results but nothing relevant to highlighting.

Captgoodhope (talkcontribs)

Okay, thank you.

Reply to "Highlight search hits"