Jump to content

Template talk:Code: Difference between revisions

From Official NixOS Wiki
Latest comment: 17 November 2025 by Malix in topic Should be Deprecated
Malix (talk | contribs)
 
Njiruk (talk | contribs)
No edit summary
Line 2: Line 2:


I think this template should be deprecated since it has become a native feature of wiki now (<code><nowiki><syntaxhighlight></nowiki></code>) [[User:Malix|Malix]] ([[User talk:Malix|talk]]) 16:47, 17 November 2025 (UTC)
I think this template should be deprecated since it has become a native feature of wiki now (<code><nowiki><syntaxhighlight></nowiki></code>) [[User:Malix|Malix]] ([[User talk:Malix|talk]]) 16:47, 17 November 2025 (UTC)
== Issue: HTML escaping in code blocks: > is not preserved ==
There is an issue with this template. E.g. in https://wiki.nixos.org/wiki/TigerVNC "&gt;" is displayed (as well as copied) instead of ">".
AI suggested the following adaptation of this template:
<code>
<includeonly>{{#ifeq:{{{copy|yes}}}|yes|
  {{#ifeq:{{{line|yes}}}|yes|
    <syntaxhighlight lang="{{{lang|text}}}" copy="" line="" {{#if:{{{highlight|}}}|highlight={{{highlight}}}}} >{{{1}}}</syntaxhighlight>|
    <syntaxhighlight lang="{{{lang|text}}}" copy="" {{#if:{{{highlight|}}}|highlight={{{highlight}}}}} >{{{1}}}</syntaxhighlight>
  }}|
  {{#ifeq:{{{line|yes}}}|yes|
    <syntaxhighlight lang="{{{lang|text}}}" line="" {{#if:{{{highlight|}}}|highlight={{{highlight}}}}} >{{{1}}}</syntaxhighlight>|
    <syntaxhighlight lang="{{{lang|text}}}" {{#if:{{{highlight|}}}|highlight={{{highlight}}}}} >{{{1}}}</syntaxhighlight>
  }}
}}</includeonly>
<noinclude>{{Documentation}}</noinclude>
</code>
Yet that makes all instances display {{{1}}} instead of the content.
I personally don't know how to get it right... Perhaps the earlier comment, that this should be deprecated, solves it..?

Revision as of 15:07, 1 April 2026

Should be Deprecated

I think this template should be deprecated since it has become a native feature of wiki now (<syntaxhighlight>) Malix (talk) 16:47, 17 November 2025 (UTC)Reply

Issue: HTML escaping in code blocks: > is not preserved

There is an issue with this template. E.g. in https://wiki.nixos.org/wiki/TigerVNC ">" is displayed (as well as copied) instead of ">".

AI suggested the following adaptation of this template:

Template Documentation [edit source| uses| help]

Template talk:Code/Doc

Yet that makes all instances display {{{1}}} instead of the content. I personally don't know how to get it right... Perhaps the earlier comment, that this should be deprecated, solves it..?