Markdown
General Principles
Section titled “General Principles”Write clear, accessible, and maintainable documentation using Markdown that renders consistently across platforms.
Document Structure
Section titled “Document Structure”Frontmatter
Section titled “Frontmatter”Use YAML frontmatter for metadata:
---title: Document Titledescription: Brief description of the documentdate: 2025-01-15tags: [documentation, guide]---File Naming
Section titled “File Naming”Use lowercase with hyphens for file names:
✅ getting-started.md✅ api-reference.md❌ GettingStarted.md❌ API_Reference.mdHeaders
Section titled “Headers”Hierarchy
Section titled “Hierarchy”Use ATX-style headers with proper hierarchy:
# Document Title (H1) - Use once per document
## Main Section (H2)
### Subsection (H3)
#### Detail Section (H4)Header Spacing
Section titled “Header Spacing”Add blank lines before and after headers:
Some content here.
## New Section
Content starts here.Header Capitalization
Section titled “Header Capitalization”Use sentence case for headers:
✅ ## Getting started with the API✅ ## Installation guide❌ ## Getting Started With The API❌ ## INSTALLATION GUIDEUnordered Lists
Section titled “Unordered Lists”Use hyphens for consistency:
- First item- Second item - Nested item - Another nested item- Third itemOrdered Lists
Section titled “Ordered Lists”Use sequential numbering for readability:
1. First step2. Second step3. Third stepFor long lists that may change, lazy numbering is acceptable:
1. First item1. Second item1. Third itemTask Lists
Section titled “Task Lists”Use GitHub-style task lists:
- [x] Completed task- [ ] Pending task- [ ] Another pending taskInline Links
Section titled “Inline Links”Prefer inline links for short URLs:
Check the [documentation](https://example.com/docs) for details.Reference Links
Section titled “Reference Links”Use reference links for repeated URLs or long URLs:
See the [API docs][api] and [user guide][guide] for more information.
[api]: https://example.com/api/reference[guide]: https://example.com/user-guideLink Text
Section titled “Link Text”Use descriptive link text:
✅ Read the [installation guide](link) for setup instructions.❌ Click [here](link) to read the installation guide.Inline Code
Section titled “Inline Code”Use backticks for inline code:
The `console.log()` function outputs to the console.Code Blocks
Section titled “Code Blocks”Always specify the language for syntax highlighting:
```javascriptfunction greet(name) { return `Hello, ${name}!`;}```
```bashnpm install package-name```
```json{ "name": "example", "version": "1.0.0"}```File Paths
Section titled “File Paths”Format file paths as inline code:
Edit the `src/config.js` file to update settings.Images
Section titled “Images”Basic Images
Section titled “Basic Images”Always include descriptive alt text:
Linked Images
Section titled “Linked Images”Wrap images in links when needed:
[](https://example.com)Image Sizing (HTML)
Section titled “Image Sizing (HTML)”Use HTML when you need specific dimensions:
<img src="./diagram.png" alt="System architecture diagram" width="600">Tables
Section titled “Tables”Use pipe tables with proper alignment:
| Feature | Description | Status || ----------- | -------------------------- | ----------- || API | RESTful API endpoints | ✅ Complete || Auth | OAuth2 authentication | 🚧 In progress || Docs | User documentation | ✅ Complete |Alignment options:
| Left aligned | Center aligned | Right aligned || :----------- | :------------: | ------------: || Left | Center | Right |Emphasis
Section titled “Emphasis”Bold and Italic
Section titled “Bold and Italic”Use asterisks for consistency:
*italic text***bold text*****bold and italic***Strikethrough
Section titled “Strikethrough”Use tildes for strikethrough (GitHub Flavored Markdown):
~~strikethrough text~~Line Length
Section titled “Line Length”Use 100-120 characters for prose to balance readability and version control:
This is a longer paragraph that demonstrates proper line length. The goal isto keep lines readable while maintaining good git diff behavior. Break linesat natural points like sentence boundaries.Code and URLs
Section titled “Code and URLs”Don’t break long URLs or code blocks for readability.
Formatting
Section titled “Formatting”Line Breaks
Section titled “Line Breaks”Use blank lines between blocks:
Paragraph one.
Paragraph two.
- List item- Another itemFor hard line breaks within a paragraph, end with two spaces or use <br>:
First lineSecond line
Or:
First line<br>Second lineHorizontal Rules
Section titled “Horizontal Rules”Use three hyphens with blank lines:
Content above.
---
Content below.Accessibility
Section titled “Accessibility”Alt Text
Section titled “Alt Text”Provide meaningful alt text for all images:
✅ ❌ ❌ Descriptive Links
Section titled “Descriptive Links”Use clear, descriptive link text:
✅ Download the [user manual (PDF, 2MB)](./manual.pdf)❌ Download the user manual [here](./manual.pdf)Document Structure
Section titled “Document Structure”Use proper heading hierarchy for screen readers:
# Main Title (H1)## Section (H2)### Subsection (H3)Don’t skip heading levels:
❌ # Title ### Subsection (skipped H2)Modern Markdown Features
Section titled “Modern Markdown Features”GitHub Flavored Markdown
Section titled “GitHub Flavored Markdown”Support for additional features:
- [x] Task lists- [ ] Unchecked items
:emoji: Emoji support
~~Strikethrough~~
Tables with alignmentAdmonitions/Callouts
Section titled “Admonitions/Callouts”Use HTML for callouts when Markdown doesn’t support them:
> **Note**: This is important information.
> **Warning**: Be careful with this operation.
> **Tip**: You can optimize performance by...HTML in Markdown
Section titled “HTML in Markdown”Use HTML when needed for accessibility or styling:
<details><summary>Click to expand</summary>
Hidden content here.
</details>
<abbr title="HyperText Markup Language">HTML</abbr>Best Practices
Section titled “Best Practices”✅ Use consistent formatting throughout ✅ Include descriptive alt text for images ✅ Specify language for code blocks ✅ Use proper heading hierarchy ✅ Add blank lines between blocks ✅ Use descriptive link text ✅ Keep line length reasonable (100-120 chars for prose) ✅ Use HTML for accessibility features
Don’ts
Section titled “Don’ts”❌ Skip heading levels ❌ Use generic link text (“click here”) ❌ Forget alt text for images ❌ Mix different list styles ❌ Use HTML for simple formatting ❌ Leave trailing whitespace ❌ Use tabs for indentation
Markdown Flavors
Section titled “Markdown Flavors”Be aware of different Markdown implementations:
- CommonMark - Standard specification
- GitHub Flavored Markdown (GFM) - Adds tables, task lists, strikethrough
- MDX - Markdown with JSX/React components
- Markdown + Frontmatter - Used by static site generators
Test your documentation on your target platform.
Recommended Tools
Section titled “Recommended Tools”- Prettier - Markdown formatting
- markdownlint - Linting and style checking
- Vale - Prose style linting
- MDX - Markdown with components
- Remark - Markdown processor
Editor Extensions
Section titled “Editor Extensions”- VS Code: Markdown All in One, markdownlint
- Vim: vim-markdown, markdown-preview
- Sublime Text: MarkdownEditing