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 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGES.md
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
Expand Up @@ -601,12 +601,16 @@ const HLJS = function(hljs) {
block.className = buildClassName(block.className, language, result.language);
block.result = {
language: result.language,
re: result.relevance
// TODO: remove with version 11.0
re: result.relevance,
relavance: result.relevance,
};
if (result.second_best) {
block.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