Content added Content deleted
(simple syntax highlighter (probably works)) |
m (fix?) |
||
Line 1: | Line 1: | ||
// syntax highlighter |
// syntax highlighter |
||
var syntaxCode = document.querySelectorAll("pre"); |
var syntaxCode = document.querySelectorAll("pre"); |
||
syntaxCode.forEach(code => { |
syntaxCode.forEach((code) => { |
||
if ( |
if (code.indexOf('game.') > -1) // if the keyword exists in the code |
||
{ |
{ |
||
code.replace("game", "<span style='color: #9cdcfe;'>game</span>"); // insert element (technically) that colors the keyword |
|||
code.replace(".", "<span style='color: #b1ac8b;'>.</span>"); // ditto |
|||
} |
} |
||
}); |
}); |
Revision as of 14:24, 3 November 2023
// syntax highlighter
var syntaxCode = document.querySelectorAll("pre");
syntaxCode.forEach((code) => {
if (code.indexOf('game.') > -1) // if the keyword exists in the code
{
code.replace("game", "<span style='color: #9cdcfe;'>game</span>"); // insert element (technically) that colors the keyword
code.replace(".", "<span style='color: #b1ac8b;'>.</span>"); // ditto
}
});