Skip to content

Markdown Style

Markdown style standards: 80-character lines, backticks for code, reference-style links.

Pattern

Follow all rules in Code Style

All markdown files must follow language-agnostic standards: 2-space indentation, 80-character line limit.

Fill lines to the limit before wrapping

When wrapping at 80 characters, fill each line as full as possible. Pull words from the next line onto the current line until adding the next one would exceed 80 characters.

DON'T wrap lines short

markdown
This paragraph wraps too
early because the next word easily fits on the previous line.

DO fill lines to the 80-character limit

markdown
This paragraph wraps too early because the next word easily fits on the
previous line.

Check for short lines:

sh
node checks/line-fill.js file.md

Use backticks for all code-like elements

DON'T leave code-like elements as plain text

markdown
Edit the file skills/git-commit/SKILL.md and update the
description field. Run git commit to save your changes.

DO use backticks for all code-like elements

markdown
Edit the file `skills/git-commit/SKILL.md` and update the
`description` field. Run `git commit` to save your changes.

Use sh for shell commands unless bash features are required

Most shell examples are POSIX-compatible:

DO use sh for POSIX-compatible commands

markdown
```sh
echo "Hello World"
ls -la
```

DO use bash only when bash-specific features are needed

markdown
```bash
array=(one two three)
echo "${array[@]}"
```

Use pullquotes for prose examples, code blocks for code

DON'T use code blocks for prose examples

markdown
The user should see a welcome message.

DO use pullquotes for prose

The user should see a welcome message.

When a link URL is long enough to hurt readability or cause awkward line wrapping, extract it into a reference-style link. Use the link text as the label — not a number.

DON'T use numbered references

markdown
See the [web-modals][1] skill for details.

[1]: ../../web-modals/SKILL.md

DO use named references matching the link text

markdown
See the [web-modals][] skill for details.

[web-modals]: ../../web-modals/SKILL.md

The empty bracket [] syntax works when the label matches the link text exactly. When they differ, spell out both: [display text][label-name].

Format tables with equal-width columns

Every cell in a column must be the same width. To size a column:

  1. Find the widest cell content in that column.
  2. The column width is that content width + 2 (one space on each side).
  3. Place each cell's content within that width according to alignment:
    • Left-aligned: one leading space, content, trailing spaces to fill.
    • Right-aligned: leading spaces to fill, content, one trailing space.
    • Center-aligned: split extra spaces evenly (extra space goes trailing).

The separator row uses dashes to fill the column width minus the two padding spaces. Left-aligned columns use | --- |, right-aligned | ---: |, and center-aligned | :--: |.

Emoji count as approximately 2 characters due to variable rendering width. Tables are allowed to exceed the 80-character line limit when unavoidable.

DON'T use uneven column widths

markdown
| Name | Description |
| --- | --- |
| foo | A short one |
| bar | A longer description here |

DO pad columns to equal width

markdown
| Name | Description               |
| ---- | ------------------------- |
| foo  | A short one               |
| bar  | A longer description here |

Check for misformatted tables:

sh
node checks/tables.js file.md