Remote Software Engineer at Stripe and cellist based out of Ontario. Previously at GitLab. Fascinated with building usable, delightful software.
December 13, 2012 | 1 minute to read
I use the SyntaxHighlighter JavaScript library by Alex Gorbatchev on this site my previous site to auto-format chunks of code, resulting in nicely colored and tabulated blocks of text like this:
$.fn.dynamicInput = function(method) {
if (methods[method]) {
return methods[method].apply(this, Array.prototype.slice.call(arguments, 1));
} else if (typeof method === 'object' || !method) {
return methods.init.apply(this, arguments);
} else {
$.error('Method ' + method + ' does not exist on jQuery.dynamicInput');
}
};
It’s a fantastic tool. Unfortunately, Chrome surrounds each block of code with vertical scrollbars, regardless of the content’s length.
Luckily, fixing this issue is a breeze. Simply change line 35 in shCore.css
from this:
line-height: 1.1em;
to this:
line-height: 1.2em;
This will remove the unnecessary vertical scrollbars in Chrome and allow for consistent formatting across all major browsers.
You can find shCore.css
in the syntaxhighlighter_X.X.XX/styles
directory.
Other posts you may enjoy:
November 25, 2024 | 10 minutes to read
October 14, 2024 | 3 minutes to read
May 31, 2024 | 6 minutes to read
June 26, 2023 | 14 minutes to read
January 25, 2022 | 6 minutes to read