Skip to content

Commit

Permalink
revert this
Browse files Browse the repository at this point in the history
  • Loading branch information
joshgoebel committed Oct 27, 2020
1 parent 42cf9c3 commit b8bf164
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/highlight.js
Original file line number Diff line number Diff line change
Expand Up @@ -579,12 +579,17 @@ const HLJS = function(hljs) {
@param {Array<string>} [languageSubset]
@returns {AutoHighlightResult}
*/
let ts = {};
function highlightAuto(code, languageSubset) {
languageSubset = languageSubset || options.languages || Object.keys(languages);
var result = justTextHighlightResult(code);
var secondBest = result;
languageSubset.filter(getLanguage).filter(autoDetection).forEach(function(name) {
var before = new Date();
var current = _highlight(name, code, false);
var after = new Date();
ts[name] = ts[name] || 0;
ts[name] += (after-before);
current.language = name;
if (current.relevance > secondBest.relevance) {
secondBest = current;
Expand All @@ -598,6 +603,7 @@ const HLJS = function(hljs) {
// second_best (with underscore) is the expected API
result.second_best = secondBest;
}
console.log(Object.entries(ts).sort((a,b) => b[1]-a[1]));
return result;
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib/mode_compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function compileLanguage(language) {
function langRe(value, global) {
return new RegExp(
regex.source(value),
'm' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')
'um' + (language.case_insensitive ? 'i' : '') + (global ? 'g' : '')
);
}

Expand Down

0 comments on commit b8bf164

Please sign in to comment.