Markdown - Cheatsheet

Markdown Cheatsheet

You can use this site to generate the code for you. For example:

## Table of Contents

- [Prerequisites](#prerequisites)
- [Create](#create)

---

## Prerequisites

- Stuff
- Things

---

## Create

- More stuff
- More things

Resource: https://stackoverflow.com/questions/11948245/markdown-to-create-pages-and-table-of-contents


Add line break

Simply add two spaces after the line that you want to break on. Or use <br/>

Resource: https://stackoverflow.com/questions/26626256/how-to-insert-a-line-break-br-in-markdown


Add horizontal line break

Simply add three hyphens after the line that you want to break on. ---


Markdown Lint rules in VSCode

Rules can be defined in the settings.json:

"markdownlint.config": {
      "MD002": false,
      "MD004": false,
      "MD012": false,
      "MD013": { "code_blocks": false, "line_length": 80 },
      "MD029": false,
      "MD032": false,
      "MD033": false,
      "MD034": false,
      "MD041": false,
      "ignore": ["**/themes/**"]
    },

Markdown Lint Fixes

MD013 Line length:

FILE=path/to/file.md
sed -E 's/(.{80}[^ ]*) /\1\n/g' -i $FILE

MD022 Headers should be surrounded by blank lines:

FILE=file.md
sed -E -i 's/^(#+\s+)(.*)$/\n\1\2\n/g' $FILE