---
title: "Markdown"
lang: "en"
author: "Mohammad Abu Mattar"
canonical: https://mkabumattar.com/markdown
---

[Home](/)›[Cheatsheets](/cheatsheets)

Cheatsheets

# Markdown

Markdown is a lightweight markup language designed for creating formatted text using a simple, readable syntax. It's widely used for documentation, READMEs, blogs, and content creation across the web.

6 Categories18 Sections53 ExamplesPublished: 01 Jul 2023Updated: 28 Feb 2025

MarkdownFormattingTextSyntaxHeadersListsLinksImagesCode Blocks

[Markdown for AI(opens in a new tab)](/markdown/index.md "Open the plain-Markdown version of this page, for pasting into an AI tool")

Series

[Config & Data Formats](/series/config--data-formats)4/5

[PreviousJSON](/cheatsheets/json)[NextTOML](/cheatsheets/toml)

All posts in this series (5)

Cheatsheets5

1.  [RegEx](/cheatsheets/regex)
2.  [YAML](/cheatsheets/yaml)
3.  [JSON](/cheatsheets/json)
4.  [MarkdownYou are here](/cheatsheets/markdown)
5.  [TOML](/cheatsheets/toml)

Markdown is a lightweight markup language for writing formatted content with a simple, readable syntax. It was created for writing on the web, and is now used in documentation, blogs, and note-taking apps.

The sections below cover Markdown syntax, formatting options, and practical examples.

[Getting Started](#category-getting-started)

-   [Basic Syntax](#section-basic-syntax)
-   [Headers](#section-headers)
-   [Emphasis and Formatting](#section-emphasis-and-formatting)

[Lists and Nesting](#category-lists-and-nesting)

-   [Unordered Lists](#section-unordered-lists)
-   [Ordered Lists](#section-ordered-lists)
-   [Task Lists](#section-task-lists)

[Links and Images](#category-links-and-images)

-   [Inline Links](#section-inline-links)
-   [Reference Links](#section-reference-links)
-   [Images](#section-images)

[Code and Quotes](#category-code-and-quotes)

-   [Inline Code](#section-inline-code)
-   [Code Blocks](#section-code-blocks)
-   [Blockquotes](#section-blockquotes)

[Tables and Horizontal Rules](#category-tables-and-rules)

-   [Tables](#section-tables)
-   [Table Formatting](#section-table-formatting)
-   [Horizontal Rules](#section-horizontal-rules)

[Advanced Features](#category-advanced-features)

-   [Escaping](#section-escaping)
-   [HTML and Raw Content](#section-html-and-raw)
-   [Best Practices](#section-markdown-best-practices)

No commands found

Try adjusting your search term

## Getting Started

Fundamental Markdown concepts and basic syntax for beginners.

### Basic Syntax

Introduction to Markdown file format and basic structure.

#### Accessibility

Ensure Markdown examples are clearly labeled and structured.

#### Best Practices

-   Keep your Markdown simple and readable in plain text form.
-   Use consistent formatting throughout your document.
-   Choose .md or .mdx extension based on your needs.

#### Common Errors

-   **Inconsistent heading levels creating confusing hierarchy.:** Use heading levels sequentially (H1, then H2, not H1 then H3).

#### Keywords

markdownsyntaxplain textmarkupfile format

#### Simple Markdown file

Demonstrates a basic Markdown file with headings, paragraphs, and inline formatting.

Code

```
1# My First Markdown File2
3This is a paragraph of plain text that will be rendered as normal text.4
5You can use **bold** and *italic* text easily.
```

-   Markdown files typically use .md or .mdx extensions.
-   Plain text is rendered as-is, with newlines creating paragraphs.

#### Markdown file with structure

Shows hierarchical document structure using different heading levels.

Code

```
1# Main Title2## Chapter One3### Section 1.14
5This section introduces the topic.6
7Key points:8- First point9- Second point
```

-   Use consistent heading levels for better document organization.
-   Markdown is ideal for documentation and content-first writing.

### Headers

Create document headers and section titles using H1 through H6.

#### Accessibility

Provide semantic heading structure for screen readers.

#### Best Practices

-   Use H1 once per document as the main title.
-   Use sequential heading levels to maintain document structure.
-   Keep headers concise and descriptive.

#### Common Errors

-   **Multiple H1 headers in one document.:** Use only one H1 as the document title, rest as H2+.
-   **No space after hash symbol.:** Use '# Heading' not '#Heading'.

#### Keywords

headersheadingsh1h2h3h4h5h6

#### Hash-style headers

Hash symbols create heading levels from H1 to H6.

Code

```
1# Heading 12## Heading 23### Heading 34#### Heading 45##### Heading 56###### Heading 6
```

-   More hashes = smaller heading.
-   Space after hash is required in most Markdown parsers.

#### Underline-style headers

Underlines with equals or dashes create H1 and H2 headers.

Code

```
1Heading 12=========3
4Heading 25---------
```

-   Underline method only supports H1 and H2.
-   Less commonly used than hash syntax.

#### Headers with special characters

Headers can include special characters like &, ?, and numbers.

Code

```
1# Getting Started with APIs2## Installation & Configuration3### FAQ: Common Questions
```

-   Special characters are preserved in headers.
-   Headers are often converted to URL-friendly slugs for links.

### Emphasis and Formatting

Apply bold, italic, strikethrough, and inline code formatting.

#### Accessibility

Ensure emphasis implies meaning, not just visual style.

#### Best Practices

-   Use bold for important terms and concepts.
-   Use italic for emphasis and titles.
-   Use backticks for code references.

#### Common Errors

-   **Using emphasis for purely visual effect.:** Use emphasis semantically to mark important information.

#### Keywords

bolditalicstrikethroughemphasisformattinginline code

#### Bold and italic text

Different ways to apply bold and italic emphasis to text.

Code

```
1This is **bold text**.2This is *italic text*.3This is ***bold and italic text***.4This is __underscored bold__.5This is _underscored italic_.
```

-   Asterisks (\*) and underscores (\_) both work for emphasis.
-   \*\*bold\*\* and \_\_bold\_\_ are equivalent.

#### Strikethrough and inline code

Strikethrough and backticks for inline code formatting.

Code

```
1This is ~~strikethrough text~~.2Use `inline code` for functions and variables.3The `console.log()` function outputs to the terminal.
```

-   Strikethrough uses double tildes (~~).
-   Backticks (\`\`) preserve text formatting exactly.

#### Combined emphasis

Combining multiple emphasis styles in the same text.

Code

```
1**Bold text with `code` inside**2***Italic and bold with `code`***3**This is ~~important~~ no longer important**
```

-   Nesting emphasis works well for describing code and features.
-   Keep combined emphasis readable and meaningful.

## Lists and Nesting

Create ordered and unordered lists with proper nesting and indentation.

### Unordered Lists

Create bullet-point lists using -, \*, or + symbols.

#### Accessibility

Ensure list structure is clear for assistive technologies.

#### Best Practices

-   Use consistent bullet symbols throughout.
-   Indent nested items by 2-4 spaces.
-   Keep list items concise.

#### Common Errors

-   **Insufficient indentation for nested items.:** Use at least 2 spaces for each nesting level.

#### Keywords

unordered listsbulletsdashasteriskplusnested lists

#### Simple unordered list

Basic unordered lists with three different bullet styles.

Code

```
1- First item2- Second item3- Third item4
5* Alternative bullet style6* Another item7+ Yet another style
```

-   All three symbols (-, \*, +) are equivalent.
-   Consistency within a document is recommended.

#### Nested unordered list

Multi-level nested list demonstrating indentation structure.

Code

```
1- Parent item 12  - Child item 1.13  - Child item 1.24    - Grandchild item 1.2.15- Parent item 26  - Child item 2.1
```

-   Indent with 2-4 spaces for each nesting level.
-   Most parsers accept 2-space indentation.

#### List with multiple items

Categorized nested list structure with multiple levels.

Code

```
1- JavaScript2  - Frameworks: React, Vue, Angular3  - Libraries: D3, Three.js4- Python5  - Frameworks: Django, Flask6  - Libraries: NumPy, Pandas
```

-   Well-structured lists are easier to read and understand.

### Ordered Lists

Create numbered lists with 1., 2., 3. syntax.

#### Accessibility

Ensure numbering is semantic and clear.

#### Best Practices

-   Use ordered lists for steps or sequences.
-   Use unordered lists for non-sequential items.
-   Keep numbered items at similar detail levels.

#### Common Errors

-   **Incorrect indentation for sub-lists.:** Indent nested lists consistently (2-4 spaces).

#### Keywords

ordered listsnumbered listsenumerationsequencenested numbered

#### Simple numbered list

Basic ordered list with numeric sequence.

Code

```
11. First step22. Second step33. Third step44. Fourth step
```

-   Numbers don't need to be sequential in source (1, 1, 1 renders as 1, 2, 3).
-   Using correct numbers helps readability in the source.

#### Nested numbered and mixed lists

Nested ordered list with mixed bullet points and numbers.

Code

```
11. Installation2   1. Download the package3   2. Extract the archive4   3. Run setup52. Configuration6   - Set environment variables7   - Update config file8   - Verify settings93. Verification10   1. Run tests11   2. Check output
```

-   Mix ordered and unordered lists at different nesting levels.
-   Indentation determines the nesting relationship.

#### Ordered list with code and formatted text

Numbered list items with inline code and bold formatting.

Code

```
11. **Install** the package: `npm install markdown-parser`22. **Import** in your file: `const md = require('markdown-parser')`33. **Parse** your content with `md.parse(content)`
```

-   Lists items can contain inline formatting.

### Task Lists

Create checkbox lists with \[ \] and \[x\] for task tracking.

#### Accessibility

Provide clear indication of task status.

#### Best Practices

-   Use task lists for progress tracking.
-   Keep task descriptions clear and specific.
-   Update checkbox status as work progresses.

#### Common Errors

-   **Using \[X\] instead of \[x\] for completed items.:** Use lowercase 'x' for checked items.

#### Keywords

task listscheckboxestaskstodocompletedunchecked

#### Simple task list

Task list with unchecked and checked items.

Code

```
1- [ ] Learn Markdown basics2- [ ] Create first document3- [x] Review formatting options
```

-   Space between brackets is required: \`\[ \]\` not \`\[\]\`.
-   Checked items use lowercase 'x': \`\[x\]\`.

#### Nested task list with sub-tasks

Hierarchical task list with parent and sub-tasks.

Code

```
1- [ ] Project setup2  - [x] Create repository3  - [ ] Initialize package.json4  - [ ] Install dependencies5- [ ] Development6  - [ ] Write functions7  - [ ] Write tests8- [x] Documentation complete
```

-   Task lists are supported by GitHub, GitLab, and many Markdown renderers.
-   They're useful for project planning and issue tracking.

#### Task list with descriptions

Task list with formatted descriptions and inline code.

Code

```
1- [x] **Setup** - Install all required packages2- [ ] **Development** - Write core functionality3  - [ ] `auth.js` - User authentication4  - [ ] `database.js` - Database operations5- [ ] **Testing** - Write and run test suite6- [ ] **Documentation** - Update README files
```

-   Combine task lists with formatting for clarity.

## Links and Images

Create hyperlinks and embed images using inline and reference syntax.

### Inline Links

Create links using \[text\](url) syntax with optional titles.

#### Accessibility

Ensure link text describes the destination clearly.

#### Best Practices

-   Use descriptive link text that indicates destination.
-   Verify links are correct before publishing.
-   Use secure HTTPS URLs when possible.

#### Common Errors

-   **Using "click here" as link text.:** Use descriptive text like "Read the documentation".

#### Keywords

linkshyperlinksurlsinline linksanchorhref

#### Basic inline links

Simple inline links with descriptive anchor text.

Code

```
1[Visit OpenAI](https://openai.com)2[GitHub Profile](https://github.com)3[Documentation](https://example.com/docs)
```

-   Link text must be descriptive, not "click here".
-   URLs must include protocol (http:// or https://).

#### Links with title attribute

Links with title attributes that display on hover.

Code

```
1[Visit OpenAI](https://openai.com "OpenAI Official Site")2[Python Docs](https://docs.python.org "Python Documentation")
```

-   Title is optional and uses double quotes.
-   Titles add context about where the link goes.

#### Links within text

Inline links embedded within paragraph text.

Code

```
1For more information, check the [official documentation](https://docs.example.com).2Learn [JavaScript](https://developer.mozilla.org/en-US/docs/Web/JavaScript) from authoritative sources.
```

-   Links can be placed mid-sentence naturally.

### Reference Links

Create reusable links using \[text\]\[ref\] and \[ref\]: url syntax.

#### Accessibility

Ensure reference link text is descriptive.

#### Best Practices

-   Use reference links for frequently used URLs.
-   Group reference definitions at the end.
-   Use lowercase reference names for consistency.

#### Common Errors

-   **Reference definitions not matching link references.:** Match reference names exactly; they are case-sensitive.

#### Keywords

reference linkslink referencesreusable linksdefinitions

#### Basic reference-style links

Reference-style links defined separately from content.

Code

```
1This is [a link][ref1] and [another link][ref2].2
3[ref1]: https://example.com4[ref2]: https://example.org
```

-   Reference definitions can appear anywhere in the document.
-   Usually placed at the end for better readability.

#### Reference links with multiple definitions

Multiple reference links with clear definitions.

Code

```
1[Visit][home] our site or check [documentation][docs].2Learn about [pricing][pricing].3
4[home]: https://example.com5[docs]: https://docs.example.com6[pricing]: https://example.com/pricing
```

-   Reference links reduce duplication in long documents.

#### Implicit reference links

Reference links where text and reference are identical.

Code

```
1Visit [GitHub] for version control.2Check [Stack Overflow] for answers.3
4[GitHub]: https://github.com5[Stack Overflow]: https://stackoverflow.com
```

-   Implicit references simplify the syntax.

### Images

Embed images using !\[alt\](url) syntax with optional titles.

#### Accessibility

Always provide descriptive alt text for images.

#### Best Practices

-   Use descriptive alt text for all images.
-   Optimize images for web use.
-   Use relative paths for local images when possible.

#### Common Errors

-   **Empty or missing alt text.:** Always provide meaningful alt text describing the image.

#### Keywords

imagesimgpicturealt textaccessibility

#### Basic image syntax

Inline images with alt text and paths.

Code

```
1![Markdown Logo](https://markdown-guide.readthedocs.io/_images/markdown-mark.svg)2![Alt text for image](/path/to/image.png)
```

-   Alt text is required for accessibility.
-   URLs can be absolute or relative.

#### Images with title attribute

Images with title attributes for additional context.

Code

```
1![Python Logo](https://www.python.org/static/community_logos/python-logo.png "Python Programming Language")2![Icon](./images/icon.png "Application Icon")
```

-   Titles display on hover in web browsers.

#### Reference-style images

Reference-style image embedding with definitions.

Code

```
1![Markdown][logo]2![Another Image][img2]3
4[logo]: https://markdown-guide.readthedocs.io/_images/markdown-mark.svg "Markdown Logo"5[img2]: ./images/banner.png
```

-   Reference images work like reference links.

## Code and Quotes

Format code blocks and blockquotes for documentation and references.

### Inline Code

Wrap code references in backticks for inline formatting.

#### Accessibility

Ensure code is clearly distinguished from text.

#### Best Practices

-   Use backticks for any code reference, variable, or function name.
-   Keep inline code short and focused.
-   Combine with emphasis for important code concepts.

#### Common Errors

-   **Unmatched or inconsistent backticks.:** Use one backtick before and one after the code.

#### Keywords

inline codebacktickscode formattingkeywordsmonospace

#### Basic inline code

Inline code snippets for functions and method names.

Code

```
1Use the `console.log()` function to print output.2The `Array.map()` method transforms arrays.3Call `myFunction()` to execute your code.
```

-   Backticks must match (one on each side).
-   Code within backticks is rendered as-is.

#### Inline code with special characters

Inline code with operators and special characters.

Code

```
1The spread operator `...args` unpacks iterables.2Access object properties with `obj.key` or `obj['key']`.3Use the `${}` template literal syntax.
```

-   Special characters are preserved exactly in backticks.

#### Inline code in lists and emphasis

Inline code combined with lists and emphasis.

Code

```
1- Use `const` instead of `var` for better scoping2- The **`Array.prototype.filter()`** method is efficient3- Store result in `const result = data.map(x => x * 2)`
```

-   Code can be emphasized or nested in other structures.

### Code Blocks

Create multi-line code blocks using indentation or fences.

#### Accessibility

Specify language for proper syntax highlighting.

#### Best Practices

-   Always specify language for better readability.
-   Keep code blocks focused and self-contained.
-   Use meaningful examples in documentation.

#### Common Errors

-   **Inconsistent fence formatting.:** Use triple backticks (\`\`\`) consistently.

#### Keywords

code blocksfenced codesyntax highlightingindented codelanguage identifier

#### Fenced code block with language

Fenced code block with JavaScript syntax highlighting.

Code

```
1```javascript2function greet(name) {3  console.log(`Hello, ${name}!`);4}5
6greet('World');7```
```

-   Language identifier enables syntax highlighting.
-   Triple backticks (\`\`\`) fence the code block.

#### Python code block

Fenced code block with Python syntax highlighting.

Code

```
1```python2def fibonacci(n):3    if n <= 1:4        return n5    return fibonacci(n-1) + fibonacci(n-2)6
7print(fibonacci(10))8```
```

-   Language identifiers vary by parser but common ones include python, javascript, etc.

#### Code block without syntax highlighting

Fenced code block without language specification.

Code

```
1```2Plain text output3No syntax highlighting4Just displayed as-is5```
```

-   Useful for output, logs, or plain text.

### Blockquotes

Create blockquotes using > prefix for quotes and references.

#### Accessibility

Label quotes with source or context when relevant.

#### Best Practices

-   Use blockquotes for important notes and warnings.
-   Attribute quotes to their source when possible.
-   Keep quotes short and relevant.

#### Common Errors

-   **Missing > prefix on continuation lines.:** Use > for each line in a blockquote.

#### Keywords

blockquotesquotescitationsreferencesnesting

#### Simple blockquote

Basic blockquote with multiple lines.

Code

```
1> Markdown is a simple way to format text.2> It supports various text styles and structures.
```

-   Use > for each line or once at the beginning of a paragraph.

#### Blockquote with formatting

Blockquote with bold text, code, and multiple paragraphs.

Code

```
1> **Important:** Always validate user input before processing.2>3> Use `input.trim()` and check length requirements.
```

-   Blockquotes can contain formatted text and code.

#### Nested blockquotes

Multi-level nested blockquotes.

Code

```
1> This is the first level quote.2>3> > This is a nested quote.4> > It's indented further.5>6> Back to the first level.
```

-   Nesting is created by adding additional > symbols.

## Tables and Horizontal Rules

Create data tables and visual separators using Markdown syntax.

### Tables

Format tabular data using pipes and dashes.

#### Accessibility

Ensure tables have proper headers and clear structure.

#### Best Practices

-   Keep tables readable with consistent column widths.
-   Use meaningful headers that describe column content.
-   Limit tables to essential data only.

#### Common Errors

-   **Missing pipes or incorrect alignment syntax.:** Put a pipe between every column and match the dashes to the column count.

#### Keywords

tablesdatacolumnsrowsseparatorpipe

#### Basic table

Simple table with three columns and header row.

Code

```
1| Name   | Age | City      |2|--------|-----|-----------|3| Alice  | 28  | New York  |4| Bob    | 32  | San Diego |5| Carol  | 25  | Boston    |
```

-   Pipes (|) separate columns.
-   Dashes (---) create the separator row.

#### Table with alignment

Table with left, center, and right alignment.

Code

```
1| Left    | Center  | Right   |2|:--------|:-------:|--------:|3| Aligned | Center  | Aligned |4| Left    | Centered| Right   |
```

-   Left colon (:---) aligns left.
-   Both colons (:---:) centers.
-   Right colon (---:) aligns right.

#### Table with formatted content

Table with code and formatted text in cells.

Code

```
1| Function | Description | Example |2|----------|-------------|---------|3| `map()` | Transforms arrays | `[1,2,3].map(x => x*2)` |4| `filter()` | **Filters** items | `arr.filter(x => x > 5)` |5| `reduce()` | Combines *all* items | `arr.reduce((a,b) => a+b)` |
```

-   Tables can contain inline formatting like code and emphasis.

### Table Formatting

Apply formatting options within table cells.

#### Accessibility

Ensure formatting aids readability without obscuring content.

#### Best Practices

-   Use consistent formatting across related cells.
-   Keep cell content concise.
-   Align related information in rows.

#### Common Errors

-   **Overwhelming tables with too much formatting.:** Use formatting sparingly for emphasis only.

#### Keywords

table formattingcell stylingalignmentemphasiscode in tables

#### Table with emphasis and code

Table with bold, code, italic, and symbols.

Code

```
1| Feature | Status | Notes |2|---------|--------|-------|3| **Login** | ✓ | Uses `OAuth2` |4| Single Sign-On | In Progress | *Coming soon* |5| Multi-Factor Auth | ✗ | Planned for Q2 |
```

-   Mix formatting styles within cells as needed.

#### Table with links and images alt text

Table with hyperlinks in cells.

Code

```
1| Technology | Link | Active |2|------------|------|--------|3| [React](https://react.dev) | Official Docs | Yes |4| [Vue](https://vuejs.org) | Vue.js Site | Yes |5| Angular | [Docs](https://angular.io) | In Maintenance |
```

-   Links work within table cells.

#### Complex table layout

Complex API documentation table.

Code

```
1| API Endpoint | Method | Required Parameters | Response |2|--------------|--------|---------------------|----------|3| `/api/users` | GET | `None` | `User[]` |4| `/api/users` | POST | `name`, `email` | `User` |5| `/api/users/:id` | PUT | `id`, `updates` | `User` |6| `/api/users/:id` | DELETE | `id` | `{ success: boolean }` |
```

-   Tables work well for API documentation.

### Horizontal Rules

Create visual separators using horizontal line syntax.

#### Accessibility

Use for visual separation, not functional structure.

#### Best Practices

-   Use horizontal rules to visually separate topics.
-   Use headings for actual content structure.
-   Don't overuse separators; they can clutter documents.

#### Common Errors

-   **Using horizontal rules instead of headings for structure.:** Use headings (H1-H6) for document hierarchy.

#### Keywords

horizontal rulesseparatorsbreaksdividersvisual separation

#### Different horizontal rule styles

Three different styles of horizontal rules.

Code

```
1First section content.2
3---4
5Second section with dashes.6
7***8
9Third section with asterisks.10
11___12
13Fourth section with underscores.
```

-   All three (---, \*\*\*, \_\_\_) produce the same visual separators.

#### Horizontal rules in document structure

Horizontal rules separating document sections.

Code

```
1# Main Document2
3Introduction paragraph.4
5---6
7## Section 18
9Content for section 1.10
11---12
13## Section 214
15Content for section 2.
```

-   Rules provide visual breaks between content areas.

#### Minimal horizontal rule syntax

Simple horizontal rule separator.

Code

```
1Content above.2
3---4
5Content below.
```

-   Requires at least three characters and blank lines above/below.

## Advanced Features

Learn escaping, HTML integration, and Markdown best practices.

### Escaping

Escape special characters to display them literally.

#### Accessibility

Ensure escaped characters display correctly.

#### Best Practices

-   Only escape when necessary to prevent interpretation.
-   Use backticks for literal code instead of escaping.
-   Test special character rendering in your target renderer.

#### Common Errors

-   **Over-escaping characters that don't need escaping.:** Check which characters actually need escaping in your context.

#### Keywords

escapingbackslashspecial charactersliteralscharacters

#### Escaping special characters

Backslash escapes prevent Markdown interpretation.

Code

```
1\# Not a heading2\* Not italic \*3\[Not a link\](https://example.com)4\`Not inline code\`
```

-   Backslash (\\\\) escapes the following character.
-   Common escaped characters: #, \*, {, }, \[, \], |, \\

#### Escaping symbols in text

Escaped dollar signs, operators, and symbols.

Code

```
1This costs \$50, not $50.2Use \+ to concatenate, not +.3The \& symbol is ampersand.4C\+\+ is a programming language.
```

-   Most symbols need escaping only in specific Markdown contexts.

#### Escaping in code and tables

Escaping characters in table cells.

Code

```
1| Character | Escaped | Purpose |2|-----------|---------|---------|3| \* | \\\* | Asterisk |4| \[ | \\\[ | Bracket |5| \\ | \\\\ | Backslash |
```

-   Escaping in code blocks and tables follows Markdown rules.

### HTML and Raw Content

Embed HTML and raw content within Markdown documents.

#### Accessibility

Ensure embedded HTML is accessible and semantic.

#### Best Practices

-   Use Markdown features first, HTML as fallback.
-   Keep HTML semantic and accessible.
-   Test HTML rendering in your target platform.

#### Common Errors

-   **Mixing HTML and Markdown inconsistently.:** Use Markdown primarily, HTML only when necessary.

#### Keywords

htmlraw htmlentitiesinline htmlcustom elements

#### Inline HTML tags

Inline HTML elements mixed with Markdown text.

Code

```
1This is <mark>highlighted text</mark> using HTML.2Use <small>small text</small> for footnotes.3Create <span style="color:red">colored text</span> with HTML.
```

-   Most Markdown renderers support basic HTML tags.
-   Use HTML for formatting Markdown doesn't support.

#### HTML entities and special characters

HTML entities for special symbols.

Code

```
1Copyright &copy; 20242Registered &reg; Trademark3Em dash &mdash; separates thoughts4Left arrow &larr; navigate back
```

-   Entities are useful for symbols not on keyboard.

#### HTML block elements

Block-level HTML with embedded Markdown.

Code

```
1<div style="border: 1px solid #ccc; padding: 10px;">2This is a custom box with HTML.3Markdown formatting still works **inside**.4</div>
```

-   Most renderers support Markdown inside block HTML.

### Best Practices

Write clean, readable, and accessible Markdown documents.

#### Accessibility

Follow semantic Markdown practices for all users.

#### Best Practices

-   Use consistent formatting throughout documents.
-   Write for readability in both source and rendered form.
-   Follow a clear document structure with headings.
-   Provide descriptive alt text for all images.
-   Use meaningful link text, not placeholders.
-   Test documents in your target renderer.

#### Common Errors

-   **Inconsistent heading levels and structure.:** Plan document hierarchy before writing.
-   **Poor alt text or missing image descriptions.:** Always provide meaningful descriptions for accessibility.

#### Keywords

best practicesstandardscommonmarkreadabilityconsistencyaccessibility

[Learn more](https://spec.commonmark.org/)

#### Well-structured Markdown document

Consistent document structure with clear hierarchy.

Code

```
1# Project Documentation2
3## Overview4A brief description of the project.5
6## Installation7Steps to install and setup.8
9## Usage10Examples of how to use the project.11
12## Contributing13Guidelines for contributing.
```

-   Use consistent heading levels throughout.
-   Organize logically with clear sections.

#### Accessible Markdown with proper alt text

Markdown with accessibility considerations.

Code

```
1# User Guide2
3![Application Dashboard](./images/dashboard.png "User interface of the application")4
5**Bold** for important terms, not just styling.6Code examples use backticks: `const x = 5`.7
8- Use lists for multiple items9- Each item is clear and concise10- Organized logically
```

-   Always include alt text for images.
-   Use semantic formatting (bold, italic for meaning).

#### CommonMark compliant Markdown

CommonMark compliant Markdown document.

Code

```
1# Introduction2
3This document follows CommonMark standards.4
5```python6# Code blocks use language identifiers7def hello():8    print("Hello, World!")9```10
11[Links](https://example.com) are explicit12
13---14
15**Final thoughts** on Markdown compliance.
```

-   CommonMark is the standard for portable Markdown.

Was this useful?

## Tags

#Markdown#Formatting#Text#Syntax#Headers#Lists#Links#Images#Code Blocks

## Share

[Facebook](https://facebook.com/sharer/sharer.php?u=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown "Share on Facebook")[Twitter](https://twitter.com/intent/tweet/?text=Markdown&url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown "Share on Twitter")[LinkedIn](https://www.linkedin.com/shareArticle?mini=true&url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown&title=Markdown&summary=Markdown%20is%20a%20lightweight%20markup%20language%20designed%20for%20creating%20formatted%20text%20using%20a%20simple%2C%20readable%20syntax.%20It's%20widely%20used%20for%20documentation%2C%20READMEs%2C%20blogs%2C%20and%20content%20creation%20across%20the%20web.&source=https://mkabumattar.com "Share on LinkedIn")[WhatsApp](https://wa.me/?text=Markdown%20https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown "Share on WhatsApp")[Telegram](https://t.me/share/url?url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown&text=Markdown "Share on Telegram")[Reddit](https://www.reddit.com/submit?url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown&title=Markdown "Share on Reddit")[Hacker News](http://news.ycombinator.com/submitlink?u=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown&t=Markdown "Share on Hacker News")[Pinterest](https://pinterest.com/pin/create/button/?url=https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown&media=&description=Markdown%20is%20a%20lightweight%20markup%20language%20designed%20for%20creating%20formatted%20text%20using%20a%20simple%2C%20readable%20syntax.%20It's%20widely%20used%20for%20documentation%2C%20READMEs%2C%20blogs%2C%20and%20content%20creation%20across%20the%20web. "Share on Pinterest")[Email](<mailto:?subject=Markdown&body=Check out this article: https%3A%2F%2Fmkabumattar.com%2Fcheatsheets%2Fmarkdown>)

## Comments

## You might also enjoy

More posts on similar topics

## [JSON](/cheatsheets/json)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Data Format
-   JSON
-   Data Serialization
-   Web API
-   Configuration

JSON (JavaScript Object Notation) is a lightweight, text-based data exchange format. It's universally supported across programming languages and provides a simple, readable way to structure and transm

#JSON#Data Format#Data Serialization+5 tags

[read more](/cheatsheets/json)

## [TOML](/cheatsheets/toml)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Data Format
-   TOML
-   Configuration
-   Data Serialization
-   Settings

TOML (Tom's Obvious, Minimal Language) is a human-friendly configuration file format. Designed to be minimal, readable, and unambiguous, it's used extensively in package manifests (like Cargo.toml and

#TOML#Configuration#Data Format+5 tags

[read more](/cheatsheets/toml)

## [YAML](/cheatsheets/yaml)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Data Format
-   YAML
-   Configuration
-   Data Serialization
-   DevOps
-   Infrastructure

YAML (YAML Ain't Markup Language) is a human-friendly data serialization language widely used for configuration files, data exchange, and infrastructure-as-code. It emphasizes readability and uses ind

#YAML#Configuration#Data Serialization+6 tags

[read more](/cheatsheets/yaml)

## [RegEx](/cheatsheets/regex)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Tools
-   Regular Expressions
-   Text Processing
-   Pattern Matching
-   Development

Regular expressions (regex or regexp) are patterns used to match character combinations in strings. They handle pattern matching, validation, and text processing across nearly all programming language

#RegEx#Regular Expressions#Pattern Matching+5 tags

[read more](/cheatsheets/regex)

## [Docker](/cheatsheets/docker)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   DevOps
-   Docker
-   Containers
-   Deployment

Docker is a containerization platform that packages applications with their dependencies into isolated, portable environments called containers. It enables developers to build, ship, and run applicati

#Docker#Containers#Images+3 tags

[read more](/cheatsheets/docker)

## [Go](/cheatsheets/go)

-   [Mohammad Abu Mattar](/authors/mohammad-abu-mattar)
-   Programming Language
-   Go
-   Systems Programming
-   Web Development
-   Backend
-   Concurrency

Go is a statically typed, compiled programming language designed with simplicity and efficiency in mind. It excels at concurrent programming, which makes it a good fit for fast, scalable server applic

#Go#Golang#Programming+6 tags

[read more](/cheatsheets/go)

6 related posts
