PLT-1626/PLT-1424/PLT-1473/PLT-1483 Improved search highlighting (#3171)
* PLT-1626 Stopped breaking up hyphenated hashtags when highlighting search terms * Made hashtag search highlighting case independent * PLT-1424 Improved search highlighting when searching for CJK characters * PLT-1473 Added search term highlighting to single-line code blocks * PLT-1473 Added search term highlighting to code blocks that don't use syntax highlighting * PLT-1483 Added proper highlighting of at mentions * Fixing formatting
Этот коммит содержится в:
@@ -43,11 +43,25 @@ class MattermostMarkdownRenderer extends marked.Renderer {
|
||||
usedLanguage = 'xml';
|
||||
}
|
||||
|
||||
return syntaxHightlighting.formatCode(usedLanguage, code);
|
||||
return syntaxHightlighting.formatCode(usedLanguage, code, null, this.formattingOptions.searchTerm);
|
||||
}
|
||||
|
||||
codespan(text) {
|
||||
return '<span class="codespan__pre-wrap">' + super.codespan(text) + '</span>';
|
||||
let output = text;
|
||||
|
||||
if (this.formattingOptions.searchTerm) {
|
||||
const tokens = new Map();
|
||||
output = TextFormatting.highlightSearchTerms(output, tokens, this.formattingOptions.searchTerm);
|
||||
output = TextFormatting.replaceTokens(output, tokens);
|
||||
}
|
||||
|
||||
return (
|
||||
'<span class="codespan__pre-wrap">' +
|
||||
'<code>' +
|
||||
output +
|
||||
'</code>' +
|
||||
'</span>'
|
||||
);
|
||||
}
|
||||
|
||||
br() {
|
||||
|
||||
Ссылка в новой задаче
Block a user