Skip to content

Markdown#

This page describes the rules for Markdown files in Autoware, such as the README.md of a package and the pages of this documentation site. pre-commit checks Markdown files with markdownlint and formats them with Prettier. A CI workflow checks the spelling with CSpell.

For the writing style of the text, see the documentation guidelines.

References#

markdownlint#

pre-commit runs markdownlint through markdownlint-cli with the --fix option. The tool fixes many problems automatically. The configuration is the .markdownlint.yaml file at the root of each repository. It turns on all rules, with these changes:

RuleSettingEffect
MD013OffLines can have any length.
MD024siblings_onlyTwo headings can have the same text if they have different parents.
MD029style: orderedNumber ordered lists 1., 2., 3., not 1., 1., 1..
MD033OffInline HTML is allowed.
MD041OffThe first line does not have to be a top-level heading.
MD045OffImages do not need alternative text.
MD046OffCode blocks can be fenced or indented.
MD049OffEmphasis can use * or _.
MD059OffLink text is not checked. Still, use descriptive link text.

The rules that stay on include these:

  • Use one heading style in a file. Autoware uses ATX headings (# Heading).
  • Increase the heading level one step at a time.
  • Put a blank line before and after headings, lists, and code blocks.
  • Give each fenced code block a language, for example bash, cpp, or yaml. Use txt for plain text.
  • Do not leave trailing spaces or more than one blank line in a row.

Prettier#

pre-commit formats Markdown, YAML, JSON, and other supported files with Prettier. The configuration is the .prettierrc.yaml file at the root of each repository. Prettier aligns the columns of tables, sets the indentation of nested lists, and uses - for list items. It does not wrap the lines of a paragraph, so it keeps your line breaks.

Spell check#

The spell-check-differential workflow checks the spelling of the changed files with CSpell and the shared autoware-spell-check-dict. If you must use a word that the dictionary does not know, add it to a comment at the top of the file:

<!-- cspell:ignore Wpedantic -->

For the other options, see CI checks.

The optional pre-commit configuration .pre-commit-config-optional.yaml checks the links in Markdown files with markdown-link-check. To run it, use this command:

pre-commit run -a --config .pre-commit-config-optional.yaml

Use relative links to other Markdown files in the same repository, for example [CMake](cmake.md), so that the links also work on GitHub.