Help talk:Template

From NixOS Wiki
Latest comment: 26 October by Fidgetingbits in topic Use of file template vs syntaxhighlight

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)Reply