Jump to content

Template:CodeBox

From Wikiversity
{{{1}}}
{{{2}}}

Used to encase programming examples, with extra information attached, like a URL to run the code on a external page.

Template parameters[Edit template data]

This template prefers block formatting of parameters.

ParameterDescriptionTypeStatus
Language Style1 langstyle

The style to use for the internal <syntaxhighlight> block. See https://github.com/wikimedia/mediawiki-extensions-SyntaxHighlight_GeSHi/blob/master/SyntaxHighlight.lexers.php for supported styles.

Example
cpp
Auto value
text
Stringrequired
Code2 code

The code contained in this CodeBox

Auto value
Stringrequired
Stylestyle

Style for the top-level div.

Unknownoptional
Error Messageerroring

An error message to associate with this Code Box. Will change the style of the header. Only use if the linked code is erroneous in some way.

Example
Does not compile: Invalid type 'foo'
Stringoptional
Language Namelangname boxtitle

Name of the language in the codebox. User facing name.

Stringsuggested
Tryit URLtryiturl

Contains a URL pointing to a online REPL or similar, to allow the user to "Try out" the code in the box.

URLsuggested
Tryit Nametryitname

Name of the site the user will be sent to to run/edit the code on.

Example
TIO
Unknownsuggested