Last active
April 13, 2024 11:11
-
-
Save cfillion/7fd2bfe13465a8a37d28a9f0fd60b13b to your computer and use it in GitHub Desktop.
Syntax highlighting on the REAPER forum
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
// ==UserScript== | |
// @name Syntax highlighting | |
// @namespace https://cfillion.ca | |
// @version 1.0.3 | |
// @author cfillion | |
// @include https://forum.cockos.com/showthread.php* | |
// @include https://forum.cockos.com/showpost.php* | |
// @include https://forum.cockos.com/editpost.php* | |
// @include https://forum.cockos.com/newreply.php* | |
// @require https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.3/highlight.min.js | |
// ==/UserScript== | |
// See also: original-poster.user.js https://gist.github.com/cfillion/1ef421d54bb747fa14047d6d65aa8dae | |
// highlight.js v11 removed auto-merging of html (removes links) | |
var theme = document.createElement('link') | |
theme.rel = 'stylesheet'; | |
theme.href = 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.7.3/styles/sunburst.min.css'; | |
document.body.appendChild(theme); | |
var style = document.createElement('style') | |
style.textContent = ` | |
pre.alt2 a:link, pre.alt2 a:visited { color: white; } | |
pre.alt2 font { color: inherit; } | |
`; | |
document.body.appendChild(style); | |
hljs.configure({ | |
tabReplace: '\x20'.repeat(2), | |
languages: ['lua', 'cpp'], | |
}); | |
document.querySelectorAll('pre.alt2').forEach(hljs.highlightBlock); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment