Template:HTML comment/doc

From Bharatpedia, an open encyclopedia
< Template:HTML comment
Revision as of 14:07, 3 October 2024 by Muskit Gergous (talk | contribs) (Created page with "{{Documentation subpage}} {{Always substitute}} {{Template shortcut|hcmt|murmur}} {{Distinguish|text={{tl|Example HTML comment}}}} 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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Use this substitution to insert HTML comments (<!-- ... -->) – hidden to readers – into Wikipedia pages.

Usage

{{subst:html comment|Lorem ipsum dolor sit amet}}
<!-- Lorem ipsum dolor sit amet -->

By default a space will be added before and after the given text. Use Template:Tjp to remove it (useful in vertical comments). For example,

{{subst:html comment|collapsed=yes|

Lorem ipsum dolor sit amet

}}

will generate

<!--
	
	
Lorem ipsum dolor sit amet
	
	
-->

In substitutable templates, use {{safesubst:<noinclude />HTML comment|...}}.

Notable cases

Using this substitution allows the expansion of MediaWiki commands inside HTML comments, where they would be preserved verbatim otherwise. Compare:

{{subst:html comment|Template:HTML comment/doc}}
<!-- Template:HTML comment -->

and:

<!-- {{subst:FULLPAGENAME}} -->
<!-- {{subst:FULLPAGENAME}} -->

See also