Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions apps/docs/src/components/webkit/CodeBlock.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ const LABELS: Record<string, string> = {
ts: 'TypeScript',
typescript: 'TypeScript',
json: 'JSON',
jsonl: 'JSON Lines',
hcl: 'HCL',
graphql: 'GraphQL',
yaml: 'YAML',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ import Code from '~/components/webkit/CodeBlock.vue'

Fenced blocks are also house style. Use a fence for output the reader reads, and `<Code>` for input the reader copies.

Language tags in use: `bash`, `sh`, `json`, `javascript`, `js`, `typescript`, `ts`, `hcl`, `graphql`, `shell`, `text`, `plaintext`. Terraform is `hcl`, not `terraform`.
Language tags in use: `bash`, `sh`, `json`, `jsonl`, `javascript`, `js`, `typescript`, `ts`, `hcl`, `graphql`, `shell`, `text`, `plaintext`. Terraform is `hcl`, not `terraform`. JSON Lines, one JSON value per line, is `jsonl`, not `json`.

---

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,11 @@ Show JSON indented with two spaces, one key per line, never on a single line. A

Two outputs keep their single line, because the line is what the reader compares or searches for: a row of a table that a command prints, such as `Modules: {...}` in a `describe` output, and an error message that ends in a JSON list, such as `Error: failed to create the Firewall Rule: ["..."]`.

JSON Lines keeps one value per line by definition. A body or a file that carries one JSON value per line, such as an NDJSON request body, takes the `jsonl` tag, and each value stays on its own line.

## Tag the language, and name a file only when there is one

The language tag on a fence drives the highlighting and names the language in the bar above any block of two or more lines: `bash` reads `Shell`, `json` reads `JSON`. Give every fence a tag, and `text` to output that has no language. A one-line block shows no line numbers, and no bar unless it has a `title`.
The language tag on a fence drives the highlighting and names the language in the bar above any block of two or more lines: `bash` reads `Shell`, `json` reads `JSON`, `jsonl` reads `JSON Lines`. Give every fence a tag, and `text` to output that has no language. A one-line block shows no line numbers, and no bar unless it has a `title`.

Add `title="..."` only when the block is a file the reader saves, such as `title="azion.config.js"`. The file name takes the language's place in the bar. The props are in [Components](/en/documentation/style-guide/components/).

Expand Down
Loading