<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="de">
	<id>https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=Vorlage%3ACode_snippet%2Fdoc</id>
	<title>Vorlage:Code snippet/doc - Versionsgeschichte</title>
	<link rel="self" type="application/atom+xml" href="https://www.verzauberte-welten.de/index.php?action=history&amp;feed=atom&amp;title=Vorlage%3ACode_snippet%2Fdoc"/>
	<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Vorlage:Code_snippet/doc&amp;action=history"/>
	<updated>2026-04-05T21:58:58Z</updated>
	<subtitle>Versionsgeschichte dieser Seite in Verzauberte Welten e.V.</subtitle>
	<generator>MediaWiki 1.39.8</generator>
	<entry>
		<id>https://www.verzauberte-welten.de/index.php?title=Vorlage:Code_snippet/doc&amp;diff=75&amp;oldid=prev</id>
		<title>mw&gt;Oetterer am 3. Februar 2015 um 13:13 Uhr</title>
		<link rel="alternate" type="text/html" href="https://www.verzauberte-welten.de/index.php?title=Vorlage:Code_snippet/doc&amp;diff=75&amp;oldid=prev"/>
		<updated>2015-02-03T13:13:27Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Neue Seite&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{Documentation subpage}}&lt;br /&gt;
&amp;lt;!-- PLEASE ADD CATEGORIES AND INTERWIKIS AT THE BOTTOM OF THIS PAGE. --&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Usage==&lt;br /&gt;
Wraps a short span of text in &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; tags (see [[mw:Extension:SyntaxHighlight GeSHi]]).  This template should be used for short samples; longer content should use {{tag|pre}} or {{tag|syntaxhighlight}}. See [[wpen:Help:Wiki markup|Help:Wiki markup]] for an explanation of what the various tags do.&lt;br /&gt;
&lt;br /&gt;
If the content includes an equals sign (=), you must specify the parameter explicitly: &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{code snippet|1=date=30 Feb 2010}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The template uses the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;syntaxhighlight&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; tag with the attribute &amp;lt;code&amp;gt;enclose=&amp;quot;none&amp;quot;&amp;lt;/code&amp;gt;. This works like the combination of the &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;code&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;nowiki&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; tags, applied to the expanded wikitext. For example, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{code snippet|some '''wiki''' text}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will '''''not''''' render the word &amp;quot;wiki&amp;quot; in bold, and will render the tripled-single-quotes:&lt;br /&gt;
&lt;br /&gt;
:{{code snippet|some '''wiki''' text}}&lt;br /&gt;
&lt;br /&gt;
However, &amp;lt;code&amp;gt;&amp;lt;nowiki&amp;gt;{{code snippet|a {{tl}} call}}&amp;lt;/nowiki&amp;gt;&amp;lt;/code&amp;gt; will still invoke the template:&lt;br /&gt;
&lt;br /&gt;
:{{code snippet|a {{tl}} call}}&lt;br /&gt;
&lt;br /&gt;
Use {{tag|nowiki}} around the template name to avoid this problem:&lt;br /&gt;
&lt;br /&gt;
:{{code snippet|a &amp;lt;nowiki&amp;gt;{{tl}}&amp;lt;/nowiki&amp;gt; call}}&lt;br /&gt;
&lt;br /&gt;
When used inline with regular text, {{tnull|code}} generally looks best and is easiest to read when it is explicitly spaced apart from the regular text:&lt;br /&gt;
:{{code snippet|foo &amp;amp;nbsp;&amp;lt;nowiki&amp;gt;{{code|bar baz}}&amp;lt;/nowiki&amp;gt;&amp;amp;nbsp; quux.}}&lt;br /&gt;
is well spaced:&lt;br /&gt;
:foo &amp;amp;nbsp;{{code snippet|bar baz}}&amp;amp;nbsp; quux.&lt;br /&gt;
versus:&lt;br /&gt;
:{{code snippet|foo &amp;lt;nowiki&amp;gt;{{code snippet|bar baz}}&amp;lt;/nowiki&amp;gt; quux.}}&lt;br /&gt;
which is going to be visually confusing for many:&lt;br /&gt;
:foo {{code snippet|bar baz}} quux.&lt;br /&gt;
because &amp;quot;foo&amp;quot; and &amp;quot;{{code snippet|bar}}&amp;quot; will seem more closely associated than &amp;quot;{{code snippet|bar}}&amp;quot; and &amp;quot;{{code snippet|baz}}&amp;quot;; the width of the space character in a monospaced font is almost always larger than in a proportional font.&lt;br /&gt;
&lt;br /&gt;
Use parameter {{{2}}} (unnamed, as {{para|2}}, or more explicitly as {{para|lang}}) to specify a language for [[mw:Extension:SyntaxHighlight GeSHi]]. This option defaults to plain-text, i.e. no highlighting.  There is no highlighting option for wikitext as a markup language, though {{code snippet|html4strict}} and {{code snippet|html5}} are valid values, as are {{code snippet|php}}, {{code snippet|perl}}, {{code snippet|css}}, {{code snippet|javascript}}, {{code snippet|mysql}} and many others. Attempting to use an invalid one causes a list of valid ones to be displayed in place of the template output, when the page is previewed or saved.&lt;br /&gt;
&lt;br /&gt;
if {{{3}}} is set to yes, the template will append a &amp;quot;copy-to-clipboard&amp;quot;-link.&lt;br /&gt;
&lt;br /&gt;
This template does not need to be [[Wikipedia:Template substitution|substituted]].&lt;br /&gt;
&lt;br /&gt;
===Examples===&lt;br /&gt;
&lt;br /&gt;
{{markup&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;Lorem {{code snippet|ipsum '''dolor'''}} sit amet&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|Lorem {{code snippet|ipsum '''dolor'''}} sit amet&lt;br /&gt;
&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;The declaration {{code snippet|lang=cpp |int foo(const std::string&amp;amp; bar, const std::vector&amp;lt;long double*&amp;gt;&amp;amp; baz);}} is the prototype for a function defined later.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|The declaration {{code snippet|lang=cpp |int foo(const std::string&amp;amp; bar, const std::vector&amp;lt;long double*&amp;gt;&amp;amp; baz);}} is the prototype for a function defined later.&lt;br /&gt;
&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;If the code contains an [[wpen:equals sign]], such as {{code snippet|lang=javascript |code=var img = document.getElementsByTagName(&amp;quot;img&amp;quot;);|3=yes}}, you must identify the first parameter explicitly as {{{1}}} or {{{code}}}; see also [[:mediazilla:5138]].&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|If the code contains an [[wpen:equals sign]], such as {{code snippet|lang=javascript |code=var img = document.getElementsByTagName(&amp;quot;img&amp;quot;);|3=yes}}, you must identify the first parameter explicitly as {{{1}}} or {{{code}}}; see also [[:mediazilla:5138]].&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
===Included templates===&lt;br /&gt;
Embedded templates do not function as expected inside {{tl|code snippet}}; for longer, free-form blocks of code, which can contain templates such as {{tl|var}}, use {{tag|code snippet}} as a wrapper instead of this template.&lt;br /&gt;
&lt;br /&gt;
Templates used inside {{tl|code snippet}} expose the rendered HTML— this can be useful. For example:&lt;br /&gt;
&lt;br /&gt;
{{markup&lt;br /&gt;
|1=&amp;lt;nowiki&amp;gt;{{code snippet|&lt;br /&gt;
{{hidden |title=Title |content=http://example.org}}&lt;br /&gt;
}}&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
|2={{code snippet|&lt;br /&gt;
{{hidden |title=Title |content=http://example.org}}&lt;br /&gt;
}}&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
The above example shows the HTML rendered by the mediawiki collapse mechanism.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* {{tl|pre}}&lt;br /&gt;
* {{tl|pre2}}&lt;br /&gt;
* {{tl|code}}&lt;br /&gt;
* [[wpen:Help:Wiki markup|Help:Wiki markup]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;includeonly&amp;gt;&lt;br /&gt;
{{#ifeq:{{SUBPAGENAME}}|sandbox | |&lt;br /&gt;
[[Category:Text manipulation templates]]&lt;br /&gt;
}}&lt;br /&gt;
&amp;lt;/includeonly&amp;gt;&lt;/div&gt;</summary>
		<author><name>mw&gt;Oetterer</name></author>
	</entry>
</feed>