Skip to content

Instantly share code, notes, and snippets.

@KevinBatdorf
Last active February 13, 2024 12:59
Show Gist options
  • Save KevinBatdorf/051f43caa6869f299acc595bb97c0f3e to your computer and use it in GitHub Desktop.
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
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);
.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