User:Layer-09/Sandbox/Command
Appearance
<templatestyles src="User:Layer-09/Sandbox/Command.css" />{{#invoke:User:Layer-09/Sandbox/Command.lua|main}}
Template Documentation [edit source| uses| help]
This template displays a command or a block of code with optional line numbers, syntax highlighting, and a one-click copy button.
Usage
Command (with $ prefix)
{{User:Layer-09/Sandbox/Command|1=
nix-shell -E '<span style="color: #c00;">with import <nixpkgs> {}; stdenv.mkDerivation { name = "arm-shell"; buildInputs = [git gnumake gcc gcc-arm-embedded dtc]; }</span>'
git clone git://git.denx.de/u-boot.git
}}
Code (no $ prefix)
To display a block of code without the `$` prompt, use `|type=code`.
{{User:Layer-09/Sandbox/Command|type=code|1=
function example(message) {
// This is a comment
console.log(message);
}
}}
Parameters
- `1`: (Required) The command or code to display. For multi-line content, start the content on a new line. You can use HTML tags like `` for coloring. Use `<` and `>` for literal `<` and `>` characters.
- `type`: (Optional) The type of block to display.
- `command` (default): Displays a `$` prefix on each line.
- `code`: Displays without a `$` prefix. Line numbers still appear for multi-line blocks.