Last active
February 13, 2024 12:59
-
-
Save KevinBatdorf/051f43caa6869f299acc595bb97c0f3e to your computer and use it in GitHub Desktop.
Use special content value in Code Block Pro WordPress plugin based on language
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const addDollarBash = () => Array.from(document.querySelectorAll("div[class*='code-block-pro']")) | |
// check if direct child has a span with text "Bash" | |
.filter((b) => b.querySelector(':scope > span')?.textContent === 'Bash') | |
// add language-bash class to the parent | |
.forEach((b) => b.classList.add('language-bash')); | |
document.addEventListener("DOMContentLoaded", addDollarBash); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.language-bash:not(#\x) .line::before { | |
content: "$" !important; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment