Jump to content

Template talk:Bc

From ArchWiki
Latest comment: Wednesday at 21:14 by Andrei Korshikov in topic Proposed change for ease of copying

Proposed change for ease of copying

When I am reading an article, I often triple click on a codeblock and CTRL+C to copy commands. However, this also grabs the '#', '$' or shell prompt that is in front of the desired content. It would be nice to have a template that places the leading bits in one text element, and the actual command in another. Configured as I imagine it, triple clicking anywhere in the codeblock will only select the command portion of the codeblock text. In addition to this solution for users who like to triple click and copy, a contextual clipboard icon could appear when hovering codeblocks. This same idea could potentially be applied to Template:hc and Template:Ic as well, although it would have to be adapted for multi-line codeblocks.

I would love to try working on this myself but I am a bit confused on how to actually create a new template on this wiki. It doesn't seem that the source for the pages in the Template namespace actually hold the source for the templates themselves like they do on Wikipedia. Any pointers on template editing or feedback on my idea would be appreciated. Novemberr (talk) 17:52, 12 February 2025 (UTC)Reply

As far as I understand, representation of a wikitext—translation from {{ic/bc/etc. …}} into HTML—is done by a skin (e.g. Vector, Timeless). There are "Custom CSS" and "Custom JS" in Preferences > Appearance > Skin, so skins should be customizable.
Template:bc is used for code blocks—mostly scripts—where #! at the beginning is natural, and for interactive shell command sequences. Your implementation of template visualization must not confuse them.
Adding another template just for commands in unfeasible:
  • every current "bc" must be checked to decide if it should be changed,
  • users will definitely confuse them and use one instead of another.
I.e. it is a huge amount of implementation and maintenance work for very small gain: just make command blocks triple click friendly. And, there are a lot of examples with "variables" (italicized parameters), which cannot be blindly copy-pasted anyway…
So, I think skin customization is the only way. -- Andrei Korshikov (talk) 18:30, 30 July 2025 (UTC)Reply
Closing: I think the question was answered, and there is no activity for several months. — Andrei Korshikov (talk) 21:14, 24 September 2025 (UTC)Reply