Template:Code/doc

This template allows you to have syntax highlighting and a tab width of 4 (can be edited by providing a different size argument) to present code. The default language is Lua.

Usage
[=]code[ Note: text between brackets ([ and ]) is optional, text in bold represents a certain value (something you must replace) and the rest represents things that must be present as-is.

Parameters

 * [empty or 1]
 * The code itself.


 * lang
 * The language of the code. Must be one of the supported languages.


 * tabwidth
 * The width of the tabs. This should not be changed unless necessary, for consistency reasons.


 * line numbers
 * linenumbers
 * Whether line numbers should be shown.


 * copy button
 * Whether a button to copy the code should be displayed.

Code
alert("Hello World!");

Result
alert("Hello World!");

Code
= for i = 1, 5 do	print("Hello World!") end

Result
= for i = 1, 5 do	print("Hello World!") end

Code

 * DT item
 * DD item, explaining some code

for i = 1, 5 do	print("Uh oh, there's a bug!") end

Result

 * DT item
 * DD item, explaining some code

for i = 1, 5 do	print("Uh oh, there's a bug!") end