Skip to content

Instantly share code, notes, and snippets.

@adkdev
Created June 7, 2021 08:09
Show Gist options
  • Save adkdev/3d70a0c3fd76bac0b357fa2c28945a08 to your computer and use it in GitHub Desktop.
Save adkdev/3d70a0c3fd76bac0b357fa2c28945a08 to your computer and use it in GitHub Desktop.
Golang.org code highlight
// ==UserScript==
// @name Golang.org code highlight
// @namespace https://www.netroby.com/
// @version 0.3
// @description Add code highlight in golang.org
// @author netroby
// @include https://golang.org/*
// @include https://godoc.org/*
// @grant none
// ==/UserScript==
// Source: https://github.com/cnmade/golang-org-code-highlight-userscript/blob/master/main.js
(function() {
'use strict';
console.log("Golang.org code highlight loaded!");
var allpre = document.body.getElementsByTagName("pre");
for (var i = 0; i < allpre.length; i++) {
allpre[i].classList.add('prettyprint');
}
var script = document.createElement('script');script.type='text/javascript';
script.src="https://cdn.rawgit.com/google/code-prettify/master/loader/run_prettify.js";
document.head.appendChild(script);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment