Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Template:Code/doc: Difference between revisions

Template page
mNo edit summary
Arin Mara (talk | contribs)
mNo edit summary
 
Line 36: Line 36:
: This as opposed to how <nowiki><pre></pre></nowiki> tags usually work:
: This as opposed to how <nowiki><pre></pre></nowiki> tags usually work:
: <pre>Go ahead, use all the width :(</pre>
: <pre>Go ahead, use all the width :(</pre>
<includeonly>[[Category:Template]]</includeonly>
<includeonly>[[Category:Formatting templates]]</includeonly>
<noinclude>[[Category:Template documentation]]</noinclude>
<noinclude>[[Category:Template documentation]]</noinclude>

Latest revision as of 21:15, 18 March 2021

Main article: Template:Code

This template allows the presentation of pre-formatted text within the confines of a code-like presentation without the box taking up the entire width of the page.

Usage
Simply add the code or function name you wish to present as the second argument:
{{ code | text }}
Example
This code:
{{ code | <nowiki> {{ foo | bar }} </nowiki> }}
Would result in this:
{{ foo | bar }}
And this code:
{{code|Foo
bar
  Hah!}}
Would result in this:
Foo
bar
Hah!
Similarly this code:
{{code|10 PRINT "Hello World!"
20 END}}
Would result in this:
10 PRINT "Hello World!"
20 END
Using it inline, like this:
foo {{code|Foo what? Huh? Huh!}} bar
Would result in this:
Foo
Foo what? Huh? Huh!
bar
This as opposed to how <pre></pre> tags usually work:
Go ahead, use all the width :(