ddonche/sheriff
0.16.0
1
0
docs reference
[[code-blocks]]

Code Blocks


Sheriff supports both inline code and multi-line code blocks.

Code formatting should be used whenever you want to show commands, source code, configuration files, terminal output, or examples that should be displayed exactly as written.


Inline Code

Wrap text in backticks to create inline code.

What you write:

Use `:say()` to print text.

What it does:

Use :say() to print text.

Inline code is useful for:

  • Functions
  • Commands
  • File names
  • Keywords
  • Small snippets

Examples:

The `repeat` loop executes a block multiple times.

Run `goblin build` to build your project.

Edit `config.yall` to change site settings.


Code Blocks

For larger examples, use triple backticks.

What you write:



Hello, Sheriff.
What it does: @@TB_CODE_7@@ Everything inside the block is preserved exactly as written. --- ## Language-Aware Code Blocks You can specify a language immediately after the opening backticks. What you write:
@@TB_CODE_4@@
@@TB_CODE_4@@
javascript console.log("Hello"); @@TB_CODE_6@@

What it does:

console.log("Hello");
console.log("Hello");

This allows Sheriff to apply syntax highlighting when supported by the active theme.

Common examples:



javascript
@@TB_CODE_4@@
@@TB_CODE_4@@
python @@TB_CODE_6@@



html
@@TB_CODE_4@@
@@TB_CODE_4@@
css @@TB_CODE_6@@



json
--- ## Goblin Syntax Highlighting Sheriff includes built-in support for Goblin syntax highlighting. To highlight Goblin code, specify goblin after the opening backticks. What you write:
@@TB_CODE_4@@
@@TB_CODE_4@@
goblin repeat 1...5 as n :say(n) xx @@TB_CODE_6@@

What it does:

repeat 1...5 as n
    :say(n)
xx
repeat 1...5 as n
    :say(n)
xx

This enables Goblin-specific syntax highlighting in Sheriff.


When to Use Inline Code vs Code Blocks

Use inline code for short references:

Use `repeat` to loop.

Use code blocks for examples:



goblin repeat 1...5 as n :say(n) xx
As a rule of thumb: * Inline code explains a concept. * Code blocks demonstrate a concept. --- ## Tips * Always specify a language when showing source code. * Use goblin` for Goblin examples.

  • Keep code blocks focused on a single concept.
  • Prefer several small examples over one giant example. Even when syntax highlighting is optional, specifying the language makes your documentation easier to read and maintain.