syntax highlight example

From thelinuxwiki
Jump to: navigation, search

how to enable sane line wrapping of code / other markup

mediawiki versions (tested on) = 1.21.5,1.21.10

To make the long commands wrap, I modified the commonElements.css file in $wikihome/skins/common. Find the section:

pre, code, tt, kbd, samp, .mw-code {
       /*
        * Some browsers will render the monospace text too small, namely Firefox, Chrome and Safari.
        * Specifying any valid, second value will trigger correct behaviour without forcing a different font.
        */
       font-family: monospace, Courier;
}

and add

       white-space: pre-wrap;
       white-space: -moz-pre-wrap;
       white-space: -pre-wrap;
       white-space: -o-pre-wrap;
       word-wrap: break-word;

after the font-family line.

Viola, the <pre> text will now wrap.

Note: when upgrading MediaWiki this file may be overwritten, so you may need to make this modification again.

links

Thanks to dan at makethenmakeinstall.com for this information!!!!

taken from...

MAKE PRE TAG TEXT WRAP IN MEDIAWIKI