Skip to content

Formatting Guide

This page demonstrates various formatting options available in Material for MkDocs.

Text Formatting

You can use various text formatting options:

  • Bold text with **bold**
  • Italic text with *italic*
  • Strikethrough with ~~text~~
  • Highlighted text with ==text==
  • H2O subscript with H~2~O
  • X2 superscript with X^2^
  • ++Underline++ with ++text++

Keyboard Keys

Use keyboard shortcuts:

  • Ctrl+C to copy
  • Ctrl+V to paste
  • Cmd+Shift+P for command palette

Code

Inline code: pip install mkdocs-material

Code block with line numbers:

1
2
3
4
5
6
7
8
9
def fibonacci(n):
    """Calculate fibonacci number."""
    if n <= 1:
        return n
    return fibonacci(n-1) + fibonacci(n-2)

# Calculate the 10th fibonacci number
result = fibonacci(10)
print(f"Fibonacci(10) = {result}")

Code with highlighting specific lines:

def greet(name):
    message = f"Hello, {name}!"
    print(message)
    return message

Tabs

print("Hello World!")
console.log("Hello World!");
echo "Hello World!"

Admonitions

Note

This is a note admonition.

Abstract

This is an abstract admonition.

Info

This is an info admonition.

Tip

This is a tip admonition.

Success

This is a success admonition.

Question

This is a question admonition.

Warning

This is a warning admonition.

Failure

This is a failure admonition.

Danger

This is a danger admonition.

Bug

This is a bug admonition.

Example

This is an example admonition.

Quote

This is a quote admonition.

Collapsible Admonition

This admonition is collapsible!

Lists

Unordered Lists

  • Item 1
  • Item 2
  • Nested item 2.1
  • Nested item 2.2
  • Item 3

Ordered Lists

  1. First item
  2. Second item
  3. Third item
  4. Nested item 3.1
  5. Nested item 3.2

Task Lists

  • Completed task
  • Another completed task
  • Incomplete task
  • Another incomplete task

Diagrams with Mermaid

graph LR
    A[Start] --> B{Is it working?}
    B -->|Yes| C[Great!]
    B -->|No| D[Debug]
    D --> B
    C --> E[End]

Buttons

Get Started View on GitHub

Footnotes

Here's a sentence with a footnote1.


  1. This is the footnote content.