Questions about this topic? Sign up to ask in the talk tab.

Difference between revisions of "Template:Code"

From NetSec
Jump to: navigation, search
Line 1: Line 1:
<onlyinclude>{| class="wikitable" width="100%"
+
<includeonly>{| class="wikitable" width="100%"
 
|
 
|
 
{{{text}}}
 
{{{text}}}
|}</onlyinclude><noinclude>
+
|}</includeonly><noinclude>
  
 
=Usage=
 
=Usage=
  <pre>{{code
+
  <pre>{{code|text=your code would go here.
  |text=
+
 
  your code would go here.
+
maybe some here too.}}</pre>
  maybe some here too.
+
}}
+
</pre>
+
 
Would give you:
 
Would give you:
{{code
+
{{code|text=your code would go here.
  |text=
+
your code would go here.
+
  
maybe some here too.
+
maybe some here too.}}
}}
+
 
 +
If you want the code box to have syntax hilighting, use <nowiki><syntaxhighlight lang=""> or <source lang=""></nowiki>
  
If you want the code box to have syntax hilighting, use:
 
<pre><syntaxhighlight lang=""> or <source lang=""></pre>
 
 
Example:
 
Example:
 +
 
<pre>{{code
 
<pre>{{code
 
|text=
 
|text=

Revision as of 07:36, 2 May 2012


Usage

{{code|text=your code would go here.

maybe some here too.}}

Would give you:

your code would go here.

maybe some here too.

If you want the code box to have syntax hilighting, use <syntaxhighlight lang=""> or <source lang="">

Example:

{{code
|text=
<source lang="cpp">
int exampleFunction(int x, int y){
int Sum = x + y;
return Sum;
}
</source>
}}


Will give you:

 
int exampleFunction(int x, int y){
int Sum = x + y;
return Sum;
}