Skip to content

mkdocs examples

This page includes a few neat tricks that you can do with mkdocs. For a complete list of examples visit the mkdocs documentation.

Versioning

To create versions run these commands:

mike deploy --update-aliases 1.0 latest
mike set-default latest
mike deploy --update-aliases 2.0 latest
mkdocs serve

Code

print("hello world!")

Code with line numbers

1
2
3
4
5
def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]

Code with highlights

def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]

Code with tabs

#include <stdio.h>

int main(void) {
  printf("Hello world!\n");
  return 0;
}
#include <iostream>

int main(void) {
  std::cout << "Hello world!" << std::endl;
  return 0;
}

More tabs

If on windows download the Win32.zip file and install it.

Run brew install foo.

Run apt-get install foo.

Checklists

  • Lorem ipsum dolor sit amet, consectetur adipiscing elit
  • Vestibulum convallis sit amet nisi a tincidunt
    • In hac habitasse platea dictumst

Add a button

Launch the lab

Visit IBM Developer

Sign up!

Call outs

Tip

You can use note, abstract, info, tip, success, question warning, failure, danger, bug, quote or example.

Note

A note.

Abstract

An abstract.

Info

Some info.

Success

A success.

Question

A question.

Warning

A warning.

Danger

A danger.

Example

A example.

Bug

A bug.

Call outs with code

Note

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nulla et euismod nulla. Curabitur feugiat, tortor non consequat finibus, justo purus auctor massa, nec semper lorem quam in massa.

def bubble_sort(items):
    for i in range(len(items)):
        for j in range(len(items) - 1 - i):
            if items[j] > items[j + 1]:
                items[j], items[j + 1] = items[j + 1], items[j]

Nunc eu odio eleifend, blandit leo a, volutpat sapien. Phasellus posuere in sem ut cursus. Nullam sit amet tincidunt ipsum, sit amet elementum turpis. Etiam ipsum quam, mattis in purus vitae, lacinia fermentum enim.

Formatting

In addition to the usual italics, and bold there is now support for:

  • highlighted
  • underlined
  • strike-through

Tables

OS or Application Username Password
Windows VM Administrator foo
Linux VM root bar

Emojis

Yes, these work. 😃 👍

Embedding social media

Use the "Embed" function and copy/paste the HTML.

Images

image

Nunc eu odio eleifend, blandit leo a, volutpat sapien

right align image

Placeholder

Nunc eu odio eleifend, blandit leo a, volutpat sapien