Format markdown

From flutter/website · View interactive version

Format markdown is an AI agent skill from the GitHub repository flutter/website. Write or edit well-structured Markdown and MDX. Use for front matter, headings, lists, code fences, links, tables, other Markdown mechanics, and site-specific extensions. Pair with the write-technical-docs skill when changing prose.

How to use this skill

Skill file

Format Markdown

Use this skill for markup mechanics and document structure.

Use the write-technical-docs skill alongside it for

prose, terminology, heading wording, link text, and alt text.

Core conventions

Apply these conventions unless the target project specifies otherwise.

Document structure

When the project doesn't specify them,

assume CommonMark with GitHub Flavored Markdown (GFM) extensions.

Some platforms generate the H1 from front matter,

so the body can start at ##.

For example, don't jump from ## to ####.

including headings, paragraphs, lists, code fences, blockquotes, and tables.

Preserve adjacency when the target syntax requires it,

such as within a tight list or blockquote.

Read Semantic line breaks

before writing more than a few lines or reviewing line wrapping.

Don't use the two-trailing-spaces line break.

Restructure the text or use the platform's explicit line-break syntax.

Line breaks and line length

keeping lines to 80 characters or fewer when a clean break exists.

Headings

## Section, not ##Section.

follow the write-technical-docs rules:

use sentence case and descriptive wording with no trailing period.

Fragment targets

On docs.flutter.dev, append {: #old-id } to the revised heading.

On flutter.dev, if the generated ID changes,

place <FragmentTarget id="old-id" /> before the revised heading.

set the ID directly on the HTML element, such as <li id="old-id">.

On docs.flutter.dev, you can also apply {: #old-id }

to a Markdown block.

for an additional ID before a heading or mid-section.

Stack one <FragmentTarget> tag per ID when multiple aliases are needed,

and separate the tag or group from following Markdown blocks

with a blank line.

on fragment targets.

Lists

Use the - hyphen by default.

Don't increment the numbers.

four spaces from the list marker's indentation.

Keep the marker at the list level's margin.

Don't add leading spaces to create the four-space alignment.

````markdown

1. List item

```dart

void main() {}

```

````

under the parent item's text,

so wrapped lines and sublists render correctly.

For list _types_ and parallelism, follow write-technical-docs.

Definition lists

Put each term on one line,

then start its description with a colon and a space (: ):

Debug mode
: Enables assertions and debugging information.

Profile mode
: Preserves enough tracing information for performance analysis,
  while otherwise behaving similarly to release mode.

Alerts

Open an alert or aside with :::type and close it with ::: on its own line:

:::warning Back up the signing key
If you lose the signing key,
you can't publish updates to the existing app.
:::

Otherwise, the type supplies a default title except for secondary.

Code

rather than indented blocks,

and add a language identifier:

``` `dart ``, `` `bash ``, or `` `yaml ```.

Use ``` `text ``` for plain output or content with no specific language.

If the code contains a backtick, wrap it in double backticks:

`` code with backtick` ``.

Keep fences flush with the surrounding text's indentation level

or correctly nested inside a list item.

Links and images

Never link bare "here", "click here", "this", or a raw URL.

See write-technical-docs for the full rule.

On documentation sites that support root-relative routes,

use an explicit root-relative path such as /path/to/page

instead of a parent-directory relative path such as ../path/to/page.

In repository files such as READMEs and package documentation,

keep repository-relative links when the host requires them.

use a fragment-only target, such as #section.

Short same-page links can use inline syntax,

such as [Configuration](#configuration).

Use an implicit label that reuses the text, [How to do this][],

or a named label, [The official tutorial][tutorial].

If the document uses a link across multiple sections,

place its definition at the end of the document instead.

use an angle-bracket autolink, such as <https://example.com>.

For link text and alt text _content_, follow write-technical-docs.

Tables

Include leading and trailing pipes for clarity.

It aids review but isn't required for rendering.

such as one with merged cells, use raw HTML.

See Markdown versus HTML.

Emphasis and other inline marks

Don't mix markers.

For example, don't use __bold__ or *italic*.

Use a real heading.

escape the characters that Markdown would otherwise parse as markup,

such as \*, ` \ `, or \|` inside a table cell.

Front matter

place it at the very top of the file,

fenced by --- lines, with no blank line before it.

Quote only values that need quotation marks.

use the >- folded block scalar for a long prose value

and wrap its source semantically.

Markdown versus HTML

prefer it for readability and maintainability.

Examples include complex tables, specific accessibility attributes,

or layout that a renderer requires.

Don't use presentational markup to imitate structure.

Don't simulate structure with bold text or manual numbering.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.