Template talk:Code
Improve Template:Code with revision 301901 (and also decide what it wants to be)
}}1}}} results in identical behaviour to {{{style="user-select: all"}}}
- this appears to be a recurring element in other templates by the same maintainer
- editors must now remember a new set of arbitrary integer-key mappings
- existing values are fragile; changes to valid values will propagate across all invocations until someone fixes them
- e.g.,
{{{color}}}and{{{bg}}}abstract away CSScolorandbackground-color
- preset CSS styles have inconsistent styling and can reflow the page if changed
- see: padding, border
Given that this Wiki has pitiful tooling for mass-updates, a template rewrite must:
- maintain backwards-compatibility with previous invocations; and
- produce correct backwards-compatible output
while providing new functionality. The code paths for this backwards-compatibility will probably persist until all old invocations are sanitized.
I already have a rewrite (revision 301901) that satisfied these complaints but was reverted almost immediately;
changing the internal tag from <syntaxhighlight> to <code> will allow the template from this revision to produce correct output.
I would recommend replacing the current incarnation of Template:Code with a patched revision 301901, pending review.
On the other hand, the site administrators have made dubious changes to the site-wide CSS that revert the Vector skin styles.
<code> is effectively indistinguishable from <kbd>; the number of template changes with <kbd> committed where <code> should be is non-zero.
Perhaps Template:Code would better serve as a wrapper for <code> with sane CSS defaults (I suppose, as it is now), but maintain compatibility with syntax given by other Wikipedia ports.
idk :3 --結衣 (talk) 22:32, 29 Apr 2023
Recent edits make text with unspecified language harder to read
The older method, which was basically {{mono}} with a background, was easier to read. It's nice having the new syntaxhighlight alias, but it's come at the cost of the legibility of the regular languageless text.
— SirYodaJedi (talk) 11:45, 20 October 2025 (PDT)
- I don't understand what you're talking about. The background in the new version remains the same (it uses a slightly darker version of the background applied to the <code> tag by the site's styles). The main change is the removal of presets: unnecessary functionality is not required here. Regarding syntaxhighlight… it was already used in the template before my changes, I just replaced the {{{highlight}}} parameter with a more logical {{{lang}}}, because this value is substituted into the syntaxhighlight attribute, which is called lang. —Max34 (talk) 12:55, 20 October 2025 (PDT)