mirror of
https://github.com/McShelby/hugo-theme-relearn.git
synced 2025-02-22 11:30:21 +00:00
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:
parent
4a25b6a875
commit
865f195d59
2 changed files with 3 additions and 2 deletions
|
@ -1 +1 @@
|
||||||
7.3.2+dffe6e1ed0dfd9b297cb438839bd1af816021f18
|
7.3.2+4a25b6a875b2b452f58f70fa254a8dd19a5724dd
|
|
@ -687,7 +687,7 @@ function initCodeClipboard() {
|
||||||
var pre = code.parentNode;
|
var pre = code.parentNode;
|
||||||
pre.dataset.code = text;
|
pre.dataset.code = text;
|
||||||
var p = pre.parentNode;
|
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'))) {
|
while (p != document && (p.tagName.toLowerCase() != 'div' || !p.classList.contains('highlight'))) {
|
||||||
p = p.parentNode;
|
p = p.parentNode;
|
||||||
}
|
}
|
||||||
|
@ -718,6 +718,7 @@ function initCodeClipboard() {
|
||||||
});
|
});
|
||||||
pre.parentNode.insertBefore(button, pre.nextSibling);
|
pre.parentNode.insertBefore(button, pre.nextSibling);
|
||||||
} else {
|
} else {
|
||||||
|
code.classList.add('highlight');
|
||||||
code.dataset.code = text;
|
code.dataset.code = text;
|
||||||
code.parentNode.insertBefore(button, code.nextSibling);
|
code.parentNode.insertBefore(button, code.nextSibling);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue