Difference between revisions of "syntax highlight example"

From thelinuxwiki
Jump to: navigation, search
(Created page with " <syntaxhighlight lang="bash" inline> sqlite3 $FWDIR/conf/hit_count_rules_table.sqlite 'select datetime(start_date, "unixepoch") as time, datetime(end_date, "unixepoch") as ti...")
 
 
(3 intermediate revisions by one user not shown)
Line 1: Line 1:
 +
how to enable sane line wrapping of code / other markup
  
<syntaxhighlight lang="bash" inline>
+
mediawiki versions (tested on) = 1.21.5,1.21.10
sqlite3 $FWDIR/conf/hit_count_rules_table.sqlite 'select datetime(start_date, "unixepoch") as time, datetime(end_date, "unixepoch") as time, netobj_name, rule_uid, hits from HitCountRules where netobj_name="PBROxxRCHVCP1" and rule_uid="{609C7EC8-82CA-4A58-BEB8-226626DBD3E3}"'
+
 
</syntaxhighlight>
+
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.
 +
 
 +
<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.
 +
 
 +
==links==
 +
 
 +
Thanks to dan at makethenmakeinstall.com for this information!!!!
 +
 
 +
taken from...
 +
 
 +
[http://www.makethenmakeinstall.com/2012/12/makepretagtextwrapinmediawiki/ MAKE PRE TAG TEXT WRAP IN 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