code: set highlight flag for inline code if necessary #1022

was missing for inline code that wasn't generated by the highlight shortcode,
meaning: Markdown backticks, html <code>
This commit is contained in:
Sören Weber 2025-02-14 20:47:49 +01:00
parent 4a25b6a875
commit 865f195d59
No known key found for this signature in database
GPG key ID: BEC6D55545451B6D
2 changed files with 3 additions and 2 deletions

View file

@ -1 +1 @@
7.3.2+dffe6e1ed0dfd9b297cb438839bd1af816021f18
7.3.2+4a25b6a875b2b452f58f70fa254a8dd19a5724dd

View file

@ -687,7 +687,7 @@ function initCodeClipboard() {
var pre = code.parentNode;
pre.dataset.code = text;
var p = pre.parentNode;
// indented code blocks are missing the div
// html <pre><code> constructs and indented code blocks are missing the div
while (p != document && (p.tagName.toLowerCase() != 'div' || !p.classList.contains('highlight'))) {
p = p.parentNode;
}
@ -718,6 +718,7 @@ function initCodeClipboard() {
});
pre.parentNode.insertBefore(button, pre.nextSibling);
} else {
code.classList.add('highlight');
code.dataset.code = text;
code.parentNode.insertBefore(button, code.nextSibling);
}