Misplaced Pages

Template:HTML comment/doc: Difference between revisions

Article snapshot taken from[REDACTED] with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< Template:HTML comment Browse history interactivelyContent deleted Content addedVisualWikitext
Revision as of 14:55, 3 August 2023 editGrufo (talk | contribs)Extended confirmed users4,609 edits First draft  Latest revision as of 10:00, 1 October 2024 edit undoGrufo (talk | contribs)Extended confirmed users4,609 editsmNo edit summary 
(8 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Documentation subpage}} {{Documentation subpage}}
{{Always substitute}} {{Always substitute}}
{{Template shortcut|hcmt}} {{Template shortcut|hcmt|murmur}}
{{Distinguish|text={{tl|Example HTML comment}}}}


Use this ] to insert HTML comments (<syntaxhighlight lang="html" inline><!-- ... --></syntaxhighlight>) – hidden to readers – into Misplaced Pages pages. Use this ] to insert HTML comments (<syntaxhighlight lang="html" inline><!-- ... --></syntaxhighlight>) – hidden to readers – into Misplaced Pages pages.
Line 8: Line 9:
: <syntaxhighlight lang="wikitext" inline>{{subst:html comment|Lorem ipsum dolor sit amet}}</syntaxhighlight> : <syntaxhighlight lang="wikitext" inline>{{subst:html comment|Lorem ipsum dolor sit amet}}</syntaxhighlight>
:: ↳ <syntaxhighlight lang="html" inline><!-- Lorem ipsum dolor sit amet --></syntaxhighlight> :: ↳ <syntaxhighlight lang="html" inline><!-- Lorem ipsum dolor sit amet --></syntaxhighlight>

By default a space will be added before and after the given text. Use {{tjp|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"><!--
Lorem ipsum dolor sit amet
--></syntaxhighlight>

In substitutable templates, use <syntaxhighlight lang="wikitext" inline>{{safesubst:<noinclude />HTML comment|...}}</syntaxhighlight>.


== Notable cases == == Notable cases ==
Using this substitution allows the expansion of ] inside HTML comments, which would be preserved verbatim otherwise. Compare: Using this substitution allows the expansion of ] inside HTML comments, where they would be preserved verbatim otherwise. Compare:


: <syntaxhighlight lang="wikitext" inline>{{subst:html comment|{{subst:FULLPAGENAME}}}}</syntaxhighlight> : <syntaxhighlight lang="wikitext" inline>{{subst:html comment|{{subst:FULLPAGENAME}}}}</syntaxhighlight>
Line 28: Line 49:
] ]
] ]
]
}}</includeonly> }}</includeonly>

Latest revision as of 10:00, 1 October 2024

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}}).
Shortcuts Not to be confused with {{Example HTML comment}}.

Use this substitution to insert HTML comments (<!-- ... -->) – hidden to readers – into Misplaced Pages 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 collapsed=yes 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|{{subst:FULLPAGENAME}}}}
<!-- Template:HTML comment -->

and:

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

See also


Template:HTML comment/doc: Difference between revisions Add topic