Template:File/Doc: Difference between revisions
Appearance
No edit summary |
m →Template data: remove aliases |
||
Line 38: | Line 38: | ||
"description": "Name of the file the code belongs to", | "description": "Name of the file the code belongs to", | ||
"type": "string", | "type": "string", | ||
"required": true | "required": true | ||
}, | }, | ||
"lang": { | "lang": { | ||
Line 45: | Line 44: | ||
"description": "The programming language used in the code", | "description": "The programming language used in the code", | ||
"type": "string", | "type": "string", | ||
"required": true | "required": true | ||
}, | }, | ||
"3": { | "3": { |
Latest revision as of 17:12, 11 June 2025
This template is used to display the content of a file, or otherwise a block of code with the context of which file it would belong to.
🐍︎ main.py
def main():
pass
if __name__ == "__main__":
main()
Usage
Simply include this template in your page, specifying the language, file name and content of the file. Note that you may have to surround the code in <nowiki>
tags in order to display it correctly.
{{file|main.c|c|
<nowiki>
#include <stdio.h>
main( )
{
printf("hello, world\n");
}
</nowiki>
}}