This template simply places template code (or any other code) in a <syntaxhighlightlang="wikitext">...</syntaxhighlight> tag and then places the rendering of that code below it.
Use escape templates (see the table on the right) to replace code so it is not parsed in the preprocessor or pre-save transform. Alternatively, wrap <nowiki>...</nowiki> tags around the code (or use {{escape}}, which has a demo-escape example).
Failure to wrap <nowiki>...</nowiki> tags around the source may cause the source to be executed before it reaches this template.
{{demo|{{fail}}}} produces:
For templates that add categories (e.g. {{Article stub box}}), set |nocat= (or |demo_kill_categories=) to anything to prevent them from showing up in the output:
If the template used is based on Lua, you can pass args directly to the demonstrated module by invoking Module:Demo like so: (this would reduce server stress)
Note: It will attempt to preserve line breaks for unnamed params, but such is impossible for named params since those are stripped of whitespace/order before being passed to the module. Also note, you should use |demo_sep= instead of |sep= (all args you don't want being passed should be prefixed with demo_ if not already)