workshop-template
  • Advocacy Workshop
  • Introduction
    • Exercise Title
    • Pre-work
    • resources
      • Admin Guide
      • Contributors
      • mkdocs examples
      • Additional resources
Powered by GitBook
On this page
  • Code
  • Code with line numbers
  • Code with tabs
  • More tabs
  • Checklists
  • Add a button
  • Call outs
  • Call outs with code
  • Formatting
  • Tables
  • Emojis
  • Images
  • right align image

Was this helpful?

  1. Introduction
  2. resources

mkdocs examples

PreviousContributorsNextAdditional resources

Last updated 4 years ago

Was this helpful?

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

Code

print("hello world!")

Code with line numbers

```python linenums="1" 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

```python hl_lines="2 3"
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

=== "Tab Header"

    #include <stdio.h>

    int main(void) {
      printf("Hello world!\n");
      return 0;
    }

=== "Another Tab Header"

    #include <iostream>

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

More tabs

=== "Windows"

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

=== "MacOS"

Run `brew install foo`.

=== "Linux"

Run `apt-get install foo`.

Checklists

Add a button

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. :smiley: :+1:

Images

Nunc eu odio eleifend, blandit leo a, volutpat sapien

right align image

Nunc eu odio eleifend, blandit leo a, volutpat sapien

{: .md-button .md-button--primary }

{: .md-button }

{: .md-button .md-button--primary }

{: align=right }

mkdocs documentation
Launch the lab
Visit IBM Developer
Sign up! :fontawesome-solid-paper-plane:
image
Placeholder