Golang.org code highlight
✓ Published0🌍 Public
Aadkdev
Last edited Jun 7, 2021
Created on Jun 7, 2021
This example shows a userscript that automatically adds syntax highlighting to code blocks on golang.org and godoc.org pages. It selects every `<pre>` element in the document body and assigns the `prettyprint` class, then injects a script tag pointing to Google’s code-prettify loader (`run_prettify.js`) from a CDN. The rendering approach relies entirely on the prettify library’s default behavior to colorize Go source code. The script, authored by netroby and sourced from a GitHub repository, runs on page load without external data or configuration.
AI-generated description