Last active
January 24, 2021 13:44
-
-
Save derekhe/809a4c1ef6725e59307d0ba53706f963 to your computer and use it in GitHub Desktop.
Safari Books Online Syntax Highlight
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 SafariBooks synatx hightlihgt | |
// @description Enable syntax highlighting when viewing code in safari books online | |
// @version 1 | |
// @require https://unpkg.com/@highlightjs/cdn-assets@10.5.0/highlight.min.js | |
// @resource syntaxHighlightCSS https://unpkg.com/@highlightjs/cdn-assets@10.5.0/styles/github.min.css | |
// @match https://learning.oreilly.com/*/* | |
// @grant GM_addStyle | |
// @grant GM_getResourceText | |
// ==/UserScript== | |
var syntax_highlighter_CSS = GM_getResourceText("syntaxHighlightCSS"); | |
GM_addStyle(syntax_highlighter_CSS); | |
//hljs.configure({ | |
// languages:["java"] | |
//}) | |
hljs.initHighlighting(); | |
document.querySelectorAll('.ProgramCode').forEach((block) => { | |
hljs.highlightBlock(block, "java"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment