Skip to content

Block Example

Code Block

Basic Code Block

example.py
1
2
3
def greet(name):
  """Function to greet a person."""
  return f"Hello, {name}!"
py title="example.py" linenums="1"
def greet(name):
  """Function to greet a person."""
  return f"Hello, {name}!"

Highlighted Lines

example.py
1
2
3
def greet(name):
  """Function to greet a person."""
  return f"Hello, {name}!"
py title="example.py" linenums="1" hl_lines="2"
def greet(name):
  """Function to greet a person."""
  return f"Hello, {name}!"

Tab Blocks

Enabled by the following configuration in mkdocs.yml:

mkdocs.yml
markdown_extensions:
  - pymdownx.tabbed:
      alternate_style: true

With the format below, you can create tabbed content:

=== "Plain Text"

    This is a plain text file.

=== "Unordered List"

    - Item 1
    - Item 2
    - Item 3

=== "Ordered List"

    1. First item
    2. Second item
    3. Third item

The result will look like this:

This is a plain text file.

  • Item 1
  • Item 2
  • Item 3
  1. First item
  2. Second item
  3. Third item

Admonitions

Amonitions start with !!! followed by the type of admonition.

Note Title

This is a note admonition.

!!! note "Note Title"

    This is a note admonition.

Collapsible admonitions can be created using the ???:

Collapsible Info

This is a collapsible info admonition.

??? info "Collapsible Info"

    This is a collapsible info admonition.