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

Difference between revisions of "Template:Code"

From NetSec
Jump to: navigation, search
(Usage)
(Usage)
Line 18: Line 18:
 
maybe some here too.
 
maybe some here too.
 
  }}
 
  }}
 +
 +
If you want the code box to have syntax hilighting, use:
 +
<pre><syntaxhighlight lang=""> or <source lang=""></pre>
 +
Example:
 +
<pre>{{code
 +
|text=
 +
<source lang="cpp">
 +
int exampleFunction(int x, int y){
 +
int Sum = x + y;
 +
return Sum;
 +
}
 +
</source>
 +
}}
 +
</pre>
 +
 +
 +
Will give you:
 +
 +
{{code
 +
|text=
 +
<source lang="c">
 +
int exampleFunction(int x, int y){
 +
int Sum = x + y;
 +
return Sum;
 +
}
 +
</source>
 +
}}
  
 
</noinclude>
 
</noinclude>

Revision as of 02:31, 19 October 2011

{{{text}}}

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