The current way of marking up highlighted keywords in the search snippet is to use <strong> element, however I would like to use <mark> (HTML5).
In D8 there is a lot of talk about shifting to HMTL5, while I am for this, I think we need to better support markup choices per se, so if you want to use HMTL4, XHTML or HTML5 you can, therefore we need to stop doing hard coded markup such as...
$text = preg_replace('/' . $boundary . '(' . implode('|', $keys) . ')' . $boundary . '/iu', '<strong>\0</strong>', $text);
... and make all markup themeable, i.e. this should use theme_mark or similar.
Comments
Comment #1
jhodgdonSounds like a good idea for Drupal 8, thanks for the suggestion!
Comment #2
jacineAgreed. This should run through
theme_mark()which should be updated to use the<mark>element.Comment #3
jacineCreated an issue for
theme_mark(): #1311372: Use <mark> element for 'mark' theme hook.Comment #4
andypostAlso related #493270: search_excerpt() doesn't work well with stemming
i think we need both preprocess and theme for excerpt
Comment #5
jacineChanging the component to markup. Hopefully it will get more visibility there.
Comment #6
JvE commentedtheme_mark is not applicable here. It "Returns HTML for a marker for new or updated content.", it does not take input other than the type of mark (new/read/updated).
I'm thinking the whole search_excerpt() function should be a theme function.
With text, keywords, length (currently fixed at 256) and dots (leading, dividing and trailing) as possible inputs.
Otherwise maybe add a theme function:
Comment #7
markhalliwellComment #8
mgiffordComment #17
catchReclassifying as a task and moving to search module.
Comment #24
quietone commentedThe Search Module was approved for removal in #3476883: [Policy, no patch] Move Search module to contrib .
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3565780: [meta] Tasks to deprecate the Search module and the removal work in #3565783: [meta] Tasks to remove the Search module.
Search will be moved to a contributed project before Drupal 12.0.0 is released.