|
|
Line 1: |
Line 1: |
− | The ConsoleOutput MediaWiki extension was created by Daniel Robbins to provide highlighting of user input for interactive terminal session blocks. To use it, surround user input with <tt><console></tt> opening and closing tags. This tag works similarly to a <tt><pre></tt> tag, and preserves output formatting in the quoted text.
| |
− |
| |
− | To highlight text typed by a user, rather than program output, put a <tt>##i##</tt> input code immediately before user input on each line. This will cause all text from the <tt>##i##</tt> to the end of the line to be highlighted in orange to offset it from the prompt and other other program output.
| |
− |
| |
− | === Console Markup ===
| |
− |
| |
− | The folowing elements are available for marking up text within <tt><console></tt> elements:
| |
− |
| |
− | * {{c|##i##}} - Tag all following text on this line as user input.
| |
− | * {{c|##b##}} - Highlight the rest of the line in bold.
| |
− | * {{c|##b##text here##!b##}} - Highlight the text between both markers in bold.
| |
− | * {{c|##i##text here##!i##}} - Highlight the text between both markers as user input.
| |
− | * {{c|##g##}} - Green
| |
− | * {{c|##y##}} - Yellow
| |
− | * {{c|##bl##}} - Blue
| |
− | * {{c|##r##}} - Red
| |
− |
| |
− | === Examples ===
| |
− | Here are a few examples of the ConsoleOutput extension. First this is how you might typically display {{c|ls}} output, with a particular directory highlighted:
| |
− |
| |
| <console> | | <console> |
| www@www-smw ~/public_html $ ##i##ls | | www@www-smw ~/public_html $ ##i##ls |
Line 28: |
Line 8: |
| www@www-smw ~/public_html $ ##i##cd extensions/ | | www@www-smw ~/public_html $ ##i##cd extensions/ |
| </console> | | </console> |
− |
| |
− | And here is how you might display a more detailed example of console output, using colors:
| |
− |
| |
− | {{console|body=
| |
− | # ##i##bluetoothctl
| |
− | [##g##NEW##!g##] Controller 00:02:72:C9:62:65 antec [default]
| |
− | ##bl##[bluetooth]##!bl### ##i##power on
| |
− | Changing power on succeeded
| |
− | ##bl##[bluetooth]##!bl### ##i##agent on
| |
− | Agent registered
| |
− | ##bl##[bluetooth]##!bl### ##i##scan on
| |
− | Discovery started
| |
− | ##bl##[bluetooth]##!bl### ##i##devices
| |
− | Device 00:1F:20:3D:1E:75 Logitech K760
| |
− | ##bl##[bluetooth]##!bl### ##i##pair 00:1F:20:3D:1E:75
| |
− | Attempting to pair with 00:1F:20:3D:1E:75
| |
− | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
| |
− | ##r##[agent]##!r## Passkey: 454358
| |
− | ##r##[agent]##!r## Passkey: ##i##4##!i##54358
| |
− | ##r##[agent]##!r## Passkey: ##i##45##!i##4358
| |
− | ##r##[agent]##!r## Passkey: ##i##454##!i##358
| |
− | ##r##[agent]##!r## Passkey: ##i##4543##!i##58
| |
− | ##r##[agent]##!r## Passkey: ##i##45435##!i##8
| |
− | ##r##[agent]##!r## Passkey: ##i##454358##!i##
| |
− | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Paired: yes
| |
− | Pairing successful
| |
− | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: no
| |
− | ##bl##[bluetooth]##!bl### ##i##connect 00:1F:20:3D:1E:75
| |
− | Attempting to connect to 00:1F:20:3D:1E:75
| |
− | [##y##CHG##!y##] Device 00:1F:20:3D:1E:75 Connected: yes
| |
− | Connection successful
| |
− | ##bl##[bluetooth]##!bl### ##i##quit
| |
− | [##r##DEL##!r##] Controller 00:02:72:C9:62:65 antec [default]
| |
− | #
| |
− | }}
| |
− |
| |
− | === Installation ===
| |
− |
| |
− | To install the ConsoleOutput extension, clone it from its official source repository:
| |
− |
| |
− | {{console|body=
| |
− | $ ##i##cd extensions
| |
− | $ git clone http://git.funtoo.org/MediaWiki-ConsoleOutput ConsoleOutput
| |
− | Cloning into 'ConsoleOutput'...
| |
− | Checking connectivity... done.
| |
− | $
| |
− | }}
| |
− |
| |
− | Next, add the following line to {{f|LocalSettings.php}}:
| |
− |
| |
− | {{file|name=LocalSettings.php|body=
| |
− | require_once( "$IP/extensions/ConsoleOutput/ConsoleOutput.php" );
| |
− | }}
| |
− |
| |
− | In order to enable the colorizing of console output, add the contents of {{f|ConsoleOutput/ConsoleOutput.css}} to the MediaWiki:Common.css page on your wiki.
| |
− |
| |
− | [[Category:MediaWiki Hacks]]
| |