# Code and technical terms

Source: https://watership.ca/style-guide/code-and-technical-terms/

Decides what goes in code font, how placeholders look, when to show output, and which verbs describe what code and commands do.

This section covers code in prose and in blocks: what gets code font, how to mark the parts the reader must replace, when to show what a command prints, and the verbs for describing what code does. It applies to documentation, to interface text that quotes code, and to error messages.

The principle is that code is literal. A reader copies it, types it, or searches for it, and any change you make on the way (a paraphrase, a capital letter, a curly quote) breaks the copy. So code font marks exactly the text that must match, placeholders can’t be mistaken for real values, and nothing in code font is decorated. Interface labels are not code; they go in bold, as Interface elements says.

## Code font

### Code font scope

Rule `code-font-scope`: avoid, judgment. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-font-scope

**Put in code font anything the reader types or the product returns.** That includes commands, flags, filenames, paths, environment variables, API names (functions, methods, classes, parameters, fields), HTTP methods, status codes, keyboard keys, and values the reader enters or reads back. Inline, that is a backtick span; for more than a line, a fenced block. A pattern catches a flag, a path, a file extension, or a three-digit status code outside code font; the reviewer has to know which other words are commands and values, so this is a judgment check.

- Instead of: Run acme deploy with the --dry-run flag and check for a 200.
- Write: Run `acme deploy --dry-run` and check for a `200`.

### No code font on concepts

Rule `code-no-font-on-concepts`: avoid, judgment. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-no-font-on-concepts

**Don’t put product names or general concepts in code font.** Code font says “this exact text exists in the product.” A product name, a feature name, and an idea such as caching or authentication are words, so they stay in plain text. The name of a resource type as the API spells it (`Deployment`) is code; the idea of a deployment is not.

- Instead of: `Acme Cloud` uses `caching` to speed up `deployments`.
- Write: Acme Cloud caches build output to speed up deployments.

### No emphasis in code

Rule `code-no-emphasis`: avoid, mechanical. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-no-emphasis

**Don’t bold or italicize code.** Code font is already a distinct style, and bold or italic inside a code span or block changes what the reader thinks they must type. To draw attention to one line in a block, say which line in the sentence before the block.

- Instead of: Set `*ACME_TOKEN*` before you run the command.
- Write: Set `ACME_TOKEN` before you run the command.

## Placeholders

### Placeholder form

Rule `code-placeholders`: avoid, mechanical. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-placeholders

**Write placeholders in angle brackets with a descriptive lowercase name.** Use `<project-id>`, not `PROJECT_ID`, `{project_id}`, or `YOUR-PROJECT-ID`. Capitals look like an environment variable, and curly braces look like syntax the reader must type. Hyphens separate the words in the name.

- Instead of: `acme deploy --project PROJECT_ID`
- Write: `acme deploy --project <project-id>`

### Explain each placeholder

Rule `code-placeholder-explained`: avoid, judgment. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-placeholder-explained

**Tell the reader what each placeholder stands for and where to find the value.** Do this in the sentence before the code, or in a short list after it, the first time the placeholder appears on the page.

- Instead of: Run `acme deploy --project <project-id>`.
- Write: Run `acme deploy --project <project-id>`, where `<project-id>` is the ID shown on the project’s **Settings** page.

## Commands and output

### Run for commands

Rule `code-run-not-execute`: prefer, mechanical. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-run-not-execute

**Write “run” for commands, not “execute.”** “Run” is the everyday word and the one a reader uses at the terminal. The same goes for scripts, tests, and jobs.

- Instead of: Execute the migration script.
- Write: Run the migration script.

### Show command output

Rule `code-show-output`: prefer, judgment. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-show-output

**Show a command’s output when the output is how the reader knows it worked.** After a command that prints a result, a confirmation, or an ID the reader needs next, show what it prints, trimmed to the lines that matter. Skip the output when the command prints nothing or success is visible somewhere else. Test: cover the output and ask whether the reader can still tell, from the page alone, that the command worked; if not, the output belongs there.

- Instead of: Run `acme deploy`.
- Write: Run `acme deploy`. When it finishes, it prints `Deployed to https://example.com`.

### Language on every code block

Rule `code-block-language`: avoid, mechanical. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-block-language

**Give every fenced code block a language.** Put the language name right after the opening backticks (`` ```bash ``, `` ```json ``, `` ```python ``) so the block is highlighted and tools can tell what it holds. Use `text` for command output and for anything with no language of its own. The example shows the opening fence line.

- Instead of: `` ``` ``
- Write: `` ```bash ``

## Errors and verbs

### Error messages verbatim

Rule `code-error-verbatim`: avoid, judgment. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-error-verbatim

**Quote error messages exactly as the product prints them, in code font.** Keep the wording, capitalization, punctuation, and any error code. Readers search for the message they see, and a paraphrase doesn’t match. If the message includes a value that varies, replace that value with a placeholder and say so.

- Instead of: You’ll see an error saying the token has expired.
- Write: The command fails with `Error: token expired (code 401)`.

### Returns and responds with

Rule `code-returns-responds`: prefer, mechanical. Address: https://watership.ca/style-guide/code-and-technical-terms/#code-returns-responds

**Write “returns” for functions and “responds with” for HTTP.** A function or method returns a value. An endpoint or server responds with a status code and a body. Don’t write that an API “gives back” or “sends” a result, and don’t write that a function “responds.”

- Instead of: The endpoint returns a 404, and `getUser()` responds with a user object.
- Write: The endpoint responds with `404`, and `getUser()` returns a user object.

## About this section

**Rules.** 10 in this section: 5 mechanical, 5 judgment. Tiers: 0 never, 7 avoid, 3 prefer.

**Where the sources differ.** Google writes placeholders as PROJECT_ID, and Microsoft uses angle brackets in code and italic in interface text; the stock uses a lowercase name in angle brackets everywhere, because it survives plain text, where italic doesn’t exist and capitals read as an environment variable.

**Sources.** Google developer documentation style guide and Microsoft Writing Style Guide. Adapted under CC BY 4.0, as [Sources and license](https://watership.ca/style-guide/#sources-and-license) sets out.
