Difference between revisions of "Help:Funtoo Editing Guidelines/Source Code"
Jump to navigation
Jump to search
(Created page with "=== Displaying Source Code === To display source code, use can use the file template, specifying a <tt>lang=</tt> parameter: <pre> {{file|name=foobar|lang=python|desc=foobar...") |
(No difference)
|
Revision as of 03:17, February 24, 2019
Displaying Source Code
To display source code, use can use the file template, specifying a lang= parameter:
{{file|name=foobar|lang=python|desc=foobarosity|body= import system }}
This will produce:
foobar
(python source code) - foobarosityimport system
The parameters name
(filename), lang
(language for syntax highlighting) and desc
(Description, appearing as a caption) are optional. For a list of supported languages, see this list.
Important
If you need to display the pipe ("|") character within the body of a file template, replace each "|" with {{!}} -- otherwise your file contents will not display properly. This is necessary because {{file}} is a template and the "|" character is used as a delimiter for arguments to the template.