change class name

This commit is contained in:
John Bowdre 2023-11-05 08:06:22 -06:00
parent e336ce87a2
commit ffd7be9de5
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; overflow-x: visible;
} }
/*
Insert prompt indicators on interactive shells.
*/
.cmd::before { .cmd::before {
color: var(--base07); color: var(--base07);
content: "$ "; content: "$ ";
@ -113,12 +116,15 @@ When the code block is hovered, bring all the lines into focus.
content: "# "; content: "# ";
} }
.cmd_return {
webkit-user-select: none;
user-select: none;
}
.cmd_pwsh::before { .cmd_pwsh::before {
color: var(--base07); color: var(--base07);
content: "PS> "; 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)); document.querySelectorAll(".highlight").forEach((highlightDiv) => createCopyButton(highlightDiv));
async function copyCodeToClipboard(button, highlightDiv) { async function copyCodeToClipboard(button, highlightDiv) {
// capture all code lines in the selected block which aren't classed `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(.cmd_return)"); let codeToCopy = highlightDiv.querySelectorAll(":last-child > .torchlight > code > .line:not(.nocopy)");
// now remove the first-child of each line which has class `line-number` // now remove the first-child of each line which has class `line-number`
codeToCopy = Array.from(codeToCopy).reduce((accumulator, line) => { codeToCopy = Array.from(codeToCopy).reduce((accumulator, line) => {
if (line.firstChild.className != "line-number") { if (line.firstChild.className != "line-number") {