From 0a5b74ea31b7e50e33479ec4fbe1c66b473a20b2 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Wed, 8 Feb 2023 20:41:58 +1100 Subject: [PATCH] Dont show relevance or predicted language until we have a better way to handle translation inside markdown handlers --- CHANGELOG.md | 1 + lib/post/markdown/markdown.js | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e3b7674d..653500f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ Now, back to the program. Here are the changes for 1.0.0, with one especially no - Customflags will now show correctly when editing a post on a board with custom flags enabled. - Security improvement to the 2FA validation flow during login. - Log a few more errors related to hcaptcha/recaptcha, for debugging purposes. (already caught and returned in a friendly manner) + - Remove showing language and relevance data when auto detecting highlighted code block language - More minor bugfixes to permissions pages displays. ### 0.11.3 diff --git a/lib/post/markdown/markdown.js b/lib/post/markdown/markdown.js index dadbdb1f..afed1f5b 100644 --- a/lib/post/markdown/markdown.js +++ b/lib/post/markdown/markdown.js @@ -76,7 +76,7 @@ module.exports = { const newlineFix = escaped.replace(/^\r?\n/,''); //fix ending newline because of codeblock chunks[i] = module.exports.processRegularChunk(newlineFix, permissions); } else if (permissions.get(Permissions.USE_MARKDOWN_CODE)){ - chunks[i] = module.exports.processCodeChunk(chunks[i], highlightOptions); + chunks[i] = module.exports.ww(chunks[i], highlightOptions); } } return chunks.join(''); @@ -91,15 +91,15 @@ module.exports = { } if (!lang) { //no language specified, try automatic syntax highlighting - const { language, relevance, value } = highlightAuto(trimFix, highlightOptions.languageSubset); + const { relevance, value } = highlightAuto(trimFix, highlightOptions.languageSubset); if (relevance > highlightOptions.threshold) { - return `possible language: ${language}, relevance: ${relevance}\n${value}`; + return `${value}`; } } else if (lang === 'aa') { return `${simpleEscape(matches.groups.code)}`; } else if (validLanguages.includes(lang)) { const { value } = highlight(trimFix, { language: lang, ignoreIllegals: true }); - return `language: ${lang}\n${value}`; + return `${value}`; } //else, auto highlight relevance threshold was too low, lang was not a valid language, or lang was 'plain' return `${simpleEscape(trimFix)}`;