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

Difference between revisions of "Template:Code"

From NetSec
Jump to: navigation, search
m (quick formatting fix)
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{| class="wikitable" width="100%"
+
<includeonly>{| class="wikitable" width="100%"
 
|
 
|
 
{{{text}}}
 
{{{text}}}
|}
+
|}</includeonly><noinclude>
<noinclude>
+
=Usage=
+
<pre>{{code
+
  |text=
+
  your code would go here.
+
  maybe some here too.
+
}}
+
</pre>
+
Would give you:
+
{{code
+
  |text=
+
your code would go here.
+
  
maybe some here too.
+
=Usage=
}}
+
 
+
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=
 
<source lang="cpp">
 
<source lang="cpp">
 +
 
int exampleFunction(int x, int y){
 
int exampleFunction(int x, int y){
 
int Sum = x + y;
 
int Sum = x + y;
 
return Sum;
 
return Sum;
 
}
 
}
 +
 
</source>
 
</source>
 
}}
 
}}
Line 46: Line 33:
 
}}
 
}}
  
 +
[[category:Templates]]
 
</noinclude>
 
</noinclude>

Latest revision as of 17:56, 27 June 2016


Usage

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;
}