Template:code

Hello, you have come here looking for the meaning of the word Template:code. In DICTIOUS you will not only get to know all the dictionary meanings for the word Template:code, but we will also tell you about its etymology, its characteristics and you will know how to say Template:code in singular and plural. Everything you need to know about the word Template:code you have here. The definition of the word Template:code will help you to be more precise and correct when speaking or writing your texts. Knowing the definition ofTemplate:code, as well as those of other words, enriches your vocabulary and provides you with more and better linguistic resources.

code


This is a convenience template, which formats a short inline snippet of code with syntax highlighting of a given language. The language is specified in |1= (the first positional parameter), while |2= (the second positional parameter) is the snippet to format. If the snippet contains an equal sign, precede it with =.

Typical values for |1=:

  • text or omitted: Raw text. This simply applies a monospaced font, similarly to surrounding the snipped with <code>...</code>.
  • lua: Lua code.
  • js or javascript: JavaScript code.
  • py or python: Python code.

The possible values are those understood by the <syntaxhighlight> tag.

It is similar to Wikipedia's w:Template:code, but the argument order is opposite.

Example

  • {{code||foo("bar")}} renders as foo("bar").
  • {{code|js|=(65535).toString(16) === 'ffff'}} renders as (65535).toString(16) === 'ffff'.

See also