BossaBox

This is the playbook for engineering-playbook

Markdown Code Reviews

Style Guide

Developers should treat documentation like other source code and follow the same rules and checklists when reviewing documentation as code.

Documentation should both use good Markdown syntax to ensure it’s properly parsed, and follow good writing style guidelines to ensure the document is easy to read and understand.

Markdown

Markdown is a lightweight markup language that you can use to add formatting elements to plaintext text documents. Created by John Gruber in 2004, Markdown is now one of the world’s most popular markup languages.

Using Markdown is different from using a WYSIWYG editor. In an application like Microsoft Word, you click buttons to format words and phrases, and the changes are visible immediately. Markdown isn’t like that. When you create a Markdown-formatted file, you add Markdown syntax to the text to indicate which words and phrases should look different.

You can find more information and full documentation here.

Linters

Markdown has specific way of being formatted. It is important to respect this formatting, otherwise some interpreters which are strict won’t properly display the document. Linters are often used to help developers properly create documents by both verifying proper Markdown syntax, grammar and proper English language.

A good setup includes a markdown linter used during editing and PR build verification, and a grammar linter used while editing the document. The following are a list of linters that could be used in this setup.

markdownlint

markdownlint is a linter for markdown that verifies Markdown syntax, and also enforces rules that make the text more readable. Markdownlint-cli is an easy-to-use CLI based on Markdownlint.

It’s available as a ruby gem, an npm package, a Node.js CLI and a VS Code extension. The VS Code extension Prettier also catches all markdownlint errors.

Installing the Node.js CLI

npm install -g markdownlint-cli

Running markdownlint on a Node.js project

markdownlint **/*.md --ignore node_modules

Fixing errors automatically

markdownlint **/*.md --ignore node_modules --fix

A comprehensive list of markdownlint rules is available here.

write-good

write-good is a linter for English text that helps writing better documentation.

npm install -g write-good

Run write-good

write-good *.md

Run write-good without installing it

npx write-good *.md

Write Good is also available as an extension for VS Code

VS Code Extensions

Write Good Linter

The Write Good Linter Extension integrates with VS Code to give grammar and language advice while editing the document.

markdownlint extension

The markdownlint extension examines the Markdown documents, showing warnings for rule violations while editing.

Build Validation

Linting

To automate linting with markdownlint for PR validation in GitHub actions, you can either use linters aggregator as we do with MegaLinter in this repository or use the following YAML.

name: Markdownlint

on:
  push:
    paths:
      - "**/*.md"
  pull_request:
    paths:
      - "**/*.md"

jobs:
  lint:

    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2
    - name: Use Node.js
      uses: actions/setup-node@v1
      with:
        node-version: 12.x
    - name: Run Markdownlint
      run: |
        npm i -g markdownlint-cli
        markdownlint "**/*.md" --ignore node_modules

To automate link check in your markdown files add markdown-link-check action to your validation pipeline:

  markdown-link-check:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@master
    - uses: gaurav-nelson/github-action-markdown-link-check@v1

More information about markdown-link-check action options can be found at markdown-link-check home page

Code Review Checklist

In addition to the Code Review Checklist you should also look for these documentation specific code review items

Writing Style Guidelines

The following are some examples of writing style guidelines.

Agree in your team which guidelines you should apply to your project documentation. Save your guidelines together with your documentation, so they are easy to refer back to.

Wording

Document Organization

Headings

Lists

Images

Emphasis and special sections

General