change class name

This commit is contained in:
John Bowdre 2023-11-05 08:06:22 -06:00
parent db5e501054
commit 26f20e4269
2 changed files with 13 additions and 7 deletions

View file

@ -103,6 +103,9 @@ When the code block is hovered, bring all the lines into focus.
overflow-x: visible;
}
/*
Insert prompt indicators on interactive shells.
*/
.cmd::before {
color: var(--base07);
content: "$ ";
@ -113,12 +116,15 @@ When the code block is hovered, bring all the lines into focus.
content: "# ";
}
.cmd_return {
webkit-user-select: none;
user-select: none;
}
.cmd_pwsh::before {
color: var(--base07);
content: "PS> ";
}
/*
Don't copy shell outputs
*/
.nocopy {
webkit-user-select: none;
user-select: none;
}

View file

@ -16,8 +16,8 @@ function createCopyButton(highlightDiv) {
document.querySelectorAll(".highlight").forEach((highlightDiv) => createCopyButton(highlightDiv));
async function copyCodeToClipboard(button, highlightDiv) {
// capture all code lines in the selected block which aren't classed `cmd_return`
let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.cmd_return)");
// capture all code lines in the selected block which aren't classed `nocopy`
let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.nocopy)");
// now remove the first-child of each line which has class `line-number`
codeToCopy = Array.from(codeToCopy).reduce((accumulator, line) => {
if (line.firstChild.className != "line-number") {