Template:HTML comment/doc
![]() | This is a documentation subpage for Template:HTML comment. It may contain usage information, categories and other content that is not part of the original template page. |
![]() | This template should always be substituted (i.e., use {{subst:HTML comment}} ). |
__EXPECTUNUSEDTEMPLATE__
Use this substitution to insert HTML comments (<syntaxhighlight lang="html" inline></syntaxhighlight>) – hidden to readers – into Wikipedia pages.
Usage
- <syntaxhighlight lang="wikitext" inline>{{subst:html comment|Lorem ipsum dolor sit amet}}</syntaxhighlight>
- ↳ <syntaxhighlight lang="html" inline></syntaxhighlight>
By default a space will be added before and after the given text. Use collapsed=yes to remove it (useful in vertical comments). For example,
<syntaxhighlight lang="wikitext">{{subst:html comment|collapsed=yes|
Lorem ipsum dolor sit amet
}}</syntaxhighlight>
will generate
<syntaxhighlight lang="wikitext"></syntaxhighlight>
In substitutable templates, use <syntaxhighlight lang="wikitext" inline></syntaxhighlight>.
Notable cases
Using this substitution allows the expansion of MediaWiki commands inside HTML comments, where they would be preserved verbatim otherwise. Compare:
- <syntaxhighlight lang="wikitext" inline>{{subst:html comment|{{subst:FULLPAGENAME}}}}</syntaxhighlight>
- ↳ <syntaxhighlight lang="html" inline></syntaxhighlight>
and:
- <syntaxhighlight lang="wikitext" inline></syntaxhighlight>
- ↳ <syntaxhighlight lang="html" inline></syntaxhighlight>
See also
- {{Example HTML comment}}
- {{Comment}}