Template:CodeSnippet: Difference between revisions

From Wikibase
Jump to navigation Jump to search
Helper: render a decoded code payload with syntax highlighting; usage {{CodeSnippet|code={{#content:Qxx}}|lang=python}} (via create-page on MediaWiki MCP Server)
 
Neutralize broken template: extension-tag content is not preprocessed on MW 1.46, so it cannot wrap parser-function output (via update-page on MediaWiki MCP Server)
 
Line 1: Line 1:
<syntaxhighlight lang="{{{lang|text}}}" copy>{{{code}}}</syntaxhighlight><noinclude>
<includeonly>{{error|Template:CodeSnippet is not usable: MediaWiki 1.46 does not expand parser functions or template parameters inside &lt;syntaxhighlight&gt; / &lt;pre&gt; tags. Render decoded content directly with &lt;nowiki&gt;{{#content:Qxx}}&lt;/nowiki&gt; instead.}}</includeonly><noinclude>
{{documentation}}
Created as a helper for the multi-line demo on [[Sandbox:Temp]], then found broken: on MW 1.46 the content of extension tags is protected from preprocessing, so a <code>{{#content:Qxx}}</code> argument cannot be wrapped in <code>&lt;syntaxhighlight&gt;</code> via a template. Deletion is admin-only, so this stub replaces it. Use <nowiki>{{#content:Qxx}}</nowiki> bare for decoded payloads.
</noinclude>
</noinclude>

Latest revision as of 11:33, 30 August 2026

Created as a helper for the multi-line demo on Sandbox:Temp, then found broken: on MW 1.46 the content of extension tags is protected from preprocessing, so a argument cannot be wrapped in <syntaxhighlight> via a template. Deletion is admin-only, so this stub replaces it. Use {{#content:Qxx}} bare for decoded payloads.