Skip to content

Instantly share code, notes, and snippets.

@f5-rahm
Last active May 30, 2023 19:54
Show Gist options
  • Save f5-rahm/a983c40ce7b7fbc1d61a8406b95a2683 to your computer and use it in GitHub Desktop.
Save f5-rahm/a983c40ce7b7fbc1d61a8406b95a2683 to your computer and use it in GitHub Desktop.
DevCentral code block client-side fix with Tampermonkey
// ==UserScript==
// @name DC Code Tag Fix v2
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author Jason Rahm w/ ChatGPT Assist
// @match https://community.f5.com/*
// @icon https://www.google.com/s2/favicons?sz=64&domain=f5.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
var html = document.body.innerHTML;
// Replace <CODE> tags w/ generic pre syntax
// html = html.replace(/<CODE>/gi, '<pre class="lia-code-sample"><code>');
// Replace <CODE> tags w/ Tcl syntax highlighting
html = html.replace(/<CODE>/gi, '<pre class="lia-code-sample language-tcl"><code>');
// Replace </CODE> tags
html = html.replace(/<\/CODE>/gi, '</code></pre>');
document.body.innerHTML = html;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment