Difference between revisions of "syntax highlight example"

From thelinuxwiki
Jump to: navigation, search
 
Line 19: Line 19:
 
         white-space: -o-pre-wrap;
 
         white-space: -o-pre-wrap;
 
         word-wrap: break-word;
 
         word-wrap: break-word;
after the font-family line. Viola, the <pre> text will now wrap.
+
after the font-family line.  
 +
 
 +
<nowiki>
 +
Viola, the <pre> text will now wrap.
 +
</nowiki>
  
 
Note: when upgrading MediaWiki this file may be overwritten, so you may need to make this modification again.
 
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!!!!
 
Thanks to dan at makethenmakeinstall.com for this information!!!!

Latest revision as of 22:28, 16 April 2017

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