Help talk:Templates
Use of file template vs syntaxhighlight
This page currently recommends {{file}} template over the <syntaxhighlight> tag, but I'd like to propose we change that around for two reasons.
1) As of the next release of MediaWiki 1.43 there will be a copy flag added to the tag, which adds a button allowing you to copy the entire code block. This is especially useful for accessibility (I happen to be a voice coder, so front of mind). I would like to see all existing code blocks get auto updated to include the copy flag once the update happens.
2) The ability to include line numbers and highlights to referenced code is much clearer (I think), so having people use the tag instead of the template makes it easier to make edits when improving other people's content. For example see the highlighting added to the vscode + language support section here here.
The main caveat to using the syntaxhighlight tag is the koss of the filename at the top of the codeblock. That could be addresses by recommending putting it at the top of the codeblock in a comment, or ideally somehow adding a MediaWiki extension to allow the file name to be added to the top in mich the same way as the template (which afaik is possible, but I've never written MediaWiki extensions so not entirely sure what it involves yet). Fidgetingbits (talk) 13:23, 26 October 2024 (UTC)
- I disagree, but only in nuance. Using
{{file}}
gives us a "semantic handle" to lift and shift to whatever implementation we want in the future. In this direction, I added{{code}}
, which{{file}}
could easily use. However, I would propose we delete{{bc}}
,{{ic}}
and{{commands}}
, as they have no syntax highlighting, being functionally obsolete now. - But in general, I think we should avoid using raw tags if possible inside articles.DoggoBit (talk) 21:04, 5 June 2025 (UTC)
Merge proposal between Template:Security Warning and Template:Warning
This is a notice to notify anyone interested in the topic of templates that I have proposed merging the two templates. Further information can be found at its discussion page DoggoBit (talk) 19:03, 5 June 2025 (UTC)