Jump to content

Template:File/Doc: Difference between revisions

From NixOS Wiki
DoggoBit (talk | contribs)
Created page with "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. {{file|main.py|| def main() pass if __name__ == "__main__" main() }} == Usage == <nowiki>{{file|filename|language|contents}}</nowiki> See documentation about <code><syntaxhighlight></code> for supported languages. <nowiki>{{file|main.c|c| #include <stdio.h> main( ) { printf("hello, world\n"); } }}</nowiki> == Ex..."
 
DoggoBit (talk | contribs)
No edit summary
Line 1: Line 1:
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.
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.


{{file|main.py||
{{file|main.py|py|
def main()
<nowiki>
def main():
   pass
   pass


if __name__ == "__main__"
if __name__ == "__main__":
   main()
   main()
</nowiki>
}}
}}



Revision as of 18:31, 7 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

{{file|filename|language|contents}}

See documentation about <syntaxhighlight> for supported languages.

 {{file|main.c|c|
#include <stdio.h>

main( )
{
        printf("hello, world\n");
}
}}

Example

C︎ main.c
#include <stdio.h>

main( )
{
        printf("hello, world\n");
}