From 49ef7b6f023116f3b92ec1b8b14c5ffec356a4ae Mon Sep 17 00:00:00 2001 From: FWYongxing Date: Tue, 27 Jul 2021 00:38:52 +0800 Subject: [PATCH] Don't highlight `inline code` blocks in headers with output.html.playpen(playgroud).editable=true --- src/theme/book.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/theme/book.js b/src/theme/book.js index b22fbe5c12..79d40354b6 100644 --- a/src/theme/book.js +++ b/src/theme/book.js @@ -162,12 +162,13 @@ function playground_text(playground) { if (window.ace) { // language-rust class needs to be removed for editable // blocks or highlightjs will capture events - Array - .from(document.querySelectorAll('code.editable')) + code_nodes + .filter(function (node) {return node.classList.contains("editable"); }) .forEach(function (block) { block.classList.remove('language-rust'); }); Array - .from(document.querySelectorAll('code:not(.editable)')) + code_nodes + .filter(function (node) {return !node.classList.contains("editable"); }) .forEach(function (block) { hljs.highlightBlock(block); }); } else { code_nodes.forEach(function (block) { hljs.highlightBlock(block); });