Difference between revisions of "syntax highlight example"

From thelinuxwiki
Jump to: navigation, search
 
(One intermediate revision by one user not shown)
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!!!!
taken from
+
 
 +
taken from...
 +
 
 
[http://www.makethenmakeinstall.com/2012/12/makepretagtextwrapinmediawiki/ MAKE PRE TAG TEXT WRAP IN MEDIAWIKI]
 
[http://www.makethenmakeinstall.com/2012/12/makepretagtextwrapinmediawiki/ MAKE PRE TAG TEXT WRAP IN MEDIAWIKI]
  
 
[[category:mediawiki]]
 
[[category:mediawiki]]

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