Here's a quick way to add syntax highlighting to code blocks in the monastery:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/hi
+ghlight.js/11.7.0/styles/base16/one-light.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.
+0/highlight.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.7.
+0/languages/perl.min.js"></script>
<script>
window.addEventListener( "DOMContentLoaded", ( event ) => {
hljs.configure( {
cssSelector: '.codeblock .codetext font',
languages: new Array( 'perl', 'html', 'css', 'xml', 'json', 'yam
+l', 'diff' ),
} );
hljs.highlightAll();
/* If you use the free nodelet for only Javascript/CSS,
* and not as a display area, then you can uncomment
* the next line of Javascript.
*/
// document.getElementById( 'Free_Nodelet' ).display.style = 'none';
} );
</script>
<style>
.codeblock .codetext font {
white-space: pre;
display: block;
padding: 0.5rem;
margin: 0.5rem 1rem 0.5rem 0;
border: 1px solid #ccc;
border-radius: 0.125rem;
}
</style>
You may want to double-check the CSS selector used because I think this may differ based on other settings you've chosen.
Also, you may wish to choose a different colour scheme. highlight.js (the syntax highlighter used) comes with a huge variety of colour schemes. Scroll down to the bottom of this page to find URLs for other options. (And previews are here.)