1. Getting started¶
One-time Setup¶
- Clone this repo
- cd into newly cloned repo
pip install -r requirements.txt
- Run
./update.sh
( ) or.\update.ps1
()
Mkdocs Requirements¶
In mkdocs.yml, have the required properties:
Create a bare minimum docs/*.md codelab page:
---
codelab: true
---
# My Lab's Title
## This becomes Step 1
Hello world instructions for Task 1
## This becomes Step 2
Blah blah for Task 2
By default, the codelab considers the H2 heading as a new step. Content under a ##
(Heading 2) until the next H2 is considered a step.
2. YAML frontmatter¶
Explicitly set a title, author, report link and date. The date can also be rendered with git revision date.
---
title: Example Workshop
author: "Anonymous Penguin"
revision_date: 2022-01-10
report_bugs: http://endless.horse/
codelab: true
---
## This becomes Step 1
Hello world
## This becomes Step 2
Blah blah
Hide tabs¶
If the tabs feature enabled, you can hide tabs on a particular page:
3. Theme Config¶
In mkdocs.yml theme
:
theme:
name: material # Mkdocs Material is the base theme
custom_dir: codelab # folder to overrides, in this case 'codelab'
report_bugs: to:an@email.com # url for the Bug Report button
global: true # default false
Global¶
If the global
option is enabled, then non-index pages will be turned into codelabs by default if no codelab
property is specified.
Exclude a page by setting codelab
to false
in the page's frontmatter.
Report Bugs¶
Set the default link for reporting bugs. It will be overridden by page-specific report_bugs
property.
5. Set a custom delimiter¶
In mkdocs.yml plugins, the delimiter
is a CSS selector.
Then in a markdown page, assign an attribute to a heading.
---
codelab: true
author: Anonymous Penguin
---
# My Lab's Title
## This becomes Step 1 { step }
Hello world
## This becomes Step 2 { step }
Blah blah
# This doesn't count
Using more than one H1 is not recommended, but the plugin can handle it.
## This doesn't count
Just in case
## Here is another step { step=3 }
This will be step 3
Additional examples:
6. Duration calculated¶
Optional: set the duration attribute for steps to calculate the estimated time.
You can set durations for list items and paragraphs, too.
## Wash the dishes
1. Grab a towel.
{ duration=1:00 }
2. Run it around the rim.
{duration=1:00 }
Optional: Grab Barkeeper's Friend and some gloves for powerwashing tea stains.
{ duration=5:00 }
Note that all durations will be added together, so the step duration is not needed.