This page describes the rules for placeholders, which are names in a code example, a command, or body text that stand for a value the reader supplies, such as a project ID or an API key. A reader who copies a code example needs to recognize each placeholder as a value to replace before running the code.
The rules for the code blocks that contain placeholders are on the code examples page.
Format placeholders in code examples and commands as uppercase words with underscores between them, such as PROJECT_ID, USER_NAME, and API_KEY. In a code block, a placeholder is in code font with the rest of the code. Where the format supports italic in a code block, as HTML does with the var element, italicize the placeholder too. A Markdown code block doesn’t support italic, so there the uppercase form marks the placeholder.
Examples
- ✓
tool config set project PROJECT_ID
- ✗
tool config set project <project-id>
Rationale
An uppercase name with underscores looks different from the identifiers around it in most languages, so the reader can tell which part of a command to replace. Angle brackets, as in <project-id>, are redirection in a shell and a tag in HTML, so a code example that uses them can fail or render incorrectly.
In body text, write a placeholder in the same uppercase form as in the code, in code font and italic, as in PROJECT_ID. In Markdown, put the asterisks outside the backticks. When a placeholder is part of a command in body text, keep the whole command in one code span, with the placeholder in uppercase. In a syntax description, which shows the form of a command, with optional parts in brackets, rather than a command to run, format a placeholder the same way in body text, and as in code in a code block (placeholder-002). Don’t use a placeholder as an ordinary English term.
Examples
- ✓ Replace
PROJECT_ID with the ID of your project.
- ✗ Replace PROJECT_ID with the ID of your project.
- ✗ Replace
PROJECT_ID with the ID of your project.
- ✓ Run
tool config set project PROJECT_ID, where PROJECT_ID is the ID of your project.
- ✓ Syntax description in body text:
tool config set project PROJECT_ID [--region REGION]
- ✓ The project ID can be up to 30 characters long.
- ✗ The
PROJECT_ID can be up to 30 characters long.
Rationale
Code font shows that the placeholder belongs to the code, and italic marks it as a value that the reader replaces. Italic also keeps it apart from a real constant such as MAX_RETRIES, which uses the same uppercase form in code font without italic. Using the name from the code lets the reader match the sentence to the code example. A Markdown code span can’t contain italic, so keep a command in body text in one code span, the way it appears in a code block.
Use descriptive placeholder names. Avoid foo, bar, baz, single letters, and series of x characters. A series of x characters is acceptable where it’s the standard form, such as 4xx for the HTTP client error status codes.
Examples
- ✓
BUCKET_NAME, SERVICE_ACCOUNT_EMAIL
- ✗
FOO, X1
Rationale
A descriptive placeholder name tells the reader what value to put in its place. A name such as FOO or X1 tells the reader nothing about the value.
Use one name for each placeholder throughout a document. Don’t alternate between different names for the same concept.
Examples
- ✓
API_KEY in every code example in the guide
- ✗
API_KEY in step 1, YOUR_API_KEY in step 3
Rationale
When one value has two placeholder names in a document, the reader can’t tell whether the names refer to one value or to two.
Explain every placeholder the first time it appears. When a code block has two or more placeholders, follow the block with a list that explains each one, in the order the placeholders appear.
Examples
- ✓ After a code block with two placeholders, a list:
PROJECT_ID: the ID of your project; REGION: the region to deploy to.
- ✗ Replace the placeholders with your values.
Rationale
A reader has to know what each placeholder stands for to replace it correctly.
placeholder-001 (retired 2026-11-06): “Code font for developer
elements.” Its first sentence, code font for every developer text element
in body text, is the guide’s main code-font rule and was re-issued as
inline-002 on the inline code page. Its second sentence
was already covered: placeholders in body text by
placeholder-006, mathematical variables by
emphasis-001, and new terms by
emphasis-002. The ID stays reserved and is never
reused.