注意:

The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.

Difference between revisions of "Help:Funtoo Editing Guidelines/ConsoleOutput"

From Funtoo
Jump to navigation Jump to search
Line 34: Line 34:
}}
}}


As you can see, this renders in a way that provides a more realistic representation of what actually happened on a terminal console. The text highlighted in orangish white is supposed to be the text that the user has typed in directly.
As you can see, this renders in a way that provides a more realistic representation of what actually happened on a terminal console. The text highlighted in bright orange is supposed to be the text that the user has typed in directly.


=== Console Usage ===
=== Console Usage ===

Revision as of 03:25, February 24, 2019

Daniel Robbins has developed a custom MediaWiki extension to allow the realistic display of console output in wikitext. Here's an example to give you an idea of what it can look like:

root # bluetoothctl 
[NEW] Controller 00:02:72:C9:62:65 antec [default]
root ##bl##[bluetooth]##!bl### power on
Changing power on succeeded
root ##bl##[bluetooth]##!bl### agent on
Agent registered
root ##bl##[bluetooth]##!bl### scan on
Discovery started
root ##bl##[bluetooth]##!bl### devices
Device 00:1F:20:3D:1E:75 Logitech K760
root ##bl##[bluetooth]##!bl### pair 00:1F:20:3D:1E:75
Attempting to pair with 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
root ##r##[agent]##!r## Passkey: 454358
[CHG] Device 00:1F:20:3D:1E:75 Paired: yes
Pairing successful
[CHG] Device 00:1F:20:3D:1E:75 Connected: no
root ##bl##[bluetooth]##!bl### connect 00:1F:20:3D:1E:75
Attempting to connect to 00:1F:20:3D:1E:75
[CHG] Device 00:1F:20:3D:1E:75 Connected: yes
Connection successful
root ##bl##[bluetooth]##!bl### quit
[DEL] Controller 00:02:72:C9:62:65 antec [default]
root #

As you can see, this renders in a way that provides a more realistic representation of what actually happened on a terminal console. The text highlighted in bright orange is supposed to be the text that the user has typed in directly.

Console Usage

To display console output, use the {{console}} template:

For a root console:

{{console|body=
###i## run a command as root
}}

Produces:

root # run a command as root

For a non-root console:

{{console|body=
$ ##i##run a command as user
}}

Produces:

user $ run a command as user
   Important

Note that we use a # prompt for root and a $ prompt to denote a non-root user.

   Important

The ##i## text tags the rest of the line as being user input ("i" is for "input"). It is then highlighted in a noticeable color so it stands out from text that is not typed in by the user.

If you need to end highlighting of user input prior to the end of a line, use ##!i## to mark the end of the highlighted area.

The following special character sequences are also available:

  • ##g## - Green
  • ##y## - Yellow
  • ##bl## - Blue
  • ##r## - Red
  • ##b## - Bold

Please use the above coloring options sparingly. It is sometimes nice to use them to get wiki console output to match the colors that are displayed on a Linux console. Also note that for every color above, there is a matching ##!(colorcode)## option to turn color off prior to end of line.