Jump to content

Template:File/Doc

From Official NixOS Wiki
Revision as of 23:02, 20 May 2026 by DHCP (talk | contribs) (Usage: added {{expand}}: we should mention (somewhere) that nowiki tag makes some symbols display as `&xyz`. I see this often across the wiki.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

☶︎
This article or section needs to be expanded. Further information may be found in the related discussion page. Please consult the pedia article metapage for guidelines on contributing.

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>
}}