Jump to content

Template:File/Doc: Difference between revisions

From NixOS Wiki
DoggoBit (talk | contribs)
No edit summary
DoggoBit (talk | contribs)
No edit summary
Line 53: Line 53:
       "type": "string",
       "type": "string",
       "required": true
       "required": true
    },
    "1": {
      "deprecated": true
    },
    "2": {
      "deprecated": true
    },
    "filename": {
      "deprecated": true
    },
    "file": {
      "deprecated": true
    },
    "contents": {
      "deprecated": true
    },
    "language": {
      "deprecated": true
     }
     }
   }
   }
}
}
</templatedata></includeonly>
</templatedata></includeonly>

Revision as of 17:10, 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>
}}