Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(parser) highlightBlock result key re => relevance #2553

Merged
merged 2 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Parser Engine:

Deprecations:

- when using `highlightBlock` `result.re` deprecated. Use `result.relevance` instead. (#2552) [Josh Goebel][]
- ditto for `result.second_best.re` => `result.second_best.relevance` (#2552)
- `lexemes` is now deprecated in favor of `keywords.$pattern` key (#2519) [Josh Goebel][]
- `endSameAsBegin` is now deprecated. (#2261) [Josh Goebel][]

Expand Down
8 changes: 6 additions & 2 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,12 +682,16 @@ const HLJS = function(hljs) {
element.className = buildClassName(element.className, language, result.language);
element.result = {
language: result.language,
re: result.relevance
// TODO: remove with version 11.0
re: result.relevance,
relavance: result.relevance,
};
if (result.second_best) {
element.second_best = {
language: result.second_best.language,
re: result.second_best.relevance
// TODO: remove with version 11.0
re: result.second_best.relevance,
relavance: result.second_best.relevance
};
}
}
Expand Down