1
0
hugo/static/js/highlight-prompt.js

14 lines
557 B
JavaScript
Raw Normal View History

2024-04-23 13:21:26 +00:00
function highlight_prompt() {
var list = document.body.getElementsByClassName("language-sh hljs bash");
if ( list.length >= 1 ) {
for(i=0; i <= list.length-1; i++){
var nodes = list[i].innerHTML;
if (nodes.match(/\$ /)){
t = nodes.replace(/^\$ /mg,"<span class='prompt'>$ </span>");
document.getElementsByClassName("language-sh hljs bash")[i].innerHTML = '';
document.getElementsByClassName("language-sh hljs bash")[i].insertAdjacentHTML('afterbegin', t);
};
};
};
}