diff --git a/gulp/res/js/live.js b/gulp/res/js/live.js index 827dba43..cc6ed59e 100644 --- a/gulp/res/js/live.js +++ b/gulp/res/js/live.js @@ -53,15 +53,16 @@ window.addEventListener('settingsReady', function(event) { //after domcontentloa newReply.classList.add('quote'); replies.appendChild(newReply); } + const newPostAnchor = document.getElementById(postData.postId); + const newPost = newPostAnchor.nextSibling; if (scrollEnabled) { - window.location.hash = postData.postId; //scroll to post if enabled; + newPostAnchor.scrollIntoView(); //scroll to post if enabled; } if (notificationsEnabled) { new Notification(document.title, { body: postData.nomarkup.substring(0,100) }); } - const newPost = document.getElementById(postData.postId).nextSibling; const newPostEvent = new CustomEvent('addPost', { detail: { post: newPost, diff --git a/helpers/posting/markdown.js b/helpers/posting/markdown.js index c6482fe4..d42b5704 100644 --- a/helpers/posting/markdown.js +++ b/helpers/posting/markdown.js @@ -39,7 +39,7 @@ module.exports = { processCodeChunk: (text) => { const trimFix = text.replace(/^\s*(\r?\n)*|(\r?\n)*$/g, ''); //remove extra whitespace/newlines at ends const { language, relevance, value } = highlightAuto(trimFix, highlightOptions.languageSubset); - if (relevance >= highlightOptions.threshold) { + if (relevance > highlightOptions.threshold) { return `possible language: ${language}, relevance: ${relevance}\n${value}`; } else { return `${escape(trimFix)}`;