Widening code views on this forum

Discourse (this forum’s software) is quite a nice system overall.

However, on a forum dedicated to discussing code and config files, it is absolutely infuriating how much horizontal space it reserves for white space, leaving you often scrolling code blocks sideways, struggling to comfortably read what someone else has written.

After being upset by this for far too long, I finally figured out that I could use a very short Tampermonkey script to adopt a saner layout (for full-screen laptop use, anyway):

// ==UserScript==
// @name         Widen Discourse
// @version      -
// @description  -
// @match        https://discuss.hashicorp.com/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=hashicorp.com
// @grant        GM_addStyle
// ==/UserScript==

GM_addStyle(`
:root {
  --topic-body-width: 1690px !important;
}
`);

Tampermonkey is a bit of a heavyweight option for just applying custom CSS… but browsers nowadays seem to fail to provide a good way to do so out of the box, and I had Tampermonkey installed anyway for other purposes.

2 Likes