Docs
View the documentation locally:
Run:
and go tolocalhost:8000
to view the docs. Mkdocs hot-reloads the docs, so any changes you make will be immediately visible.
Versioning
We use mike
to manage versioning for our documentation. It creates a snapshot of the documentation for each version of the project, allowing users to access the appropriate docs for the version they're using—even if it's an older one.
Build new docs version
Build the docs for the current project version:
To push your new docs version:
The first time you use Mike, you'll need to tell it which version is the default (the one it shows when you load the docs main page). We'll set it to the "default" alias:
To list the available docs versions:
To view the versioned docs locally (with a drop-down to select which docs version you want):
Writing
These are some tools you can use to enrich the documentation.
Diagrams
Mermaid diagrams can be written in a mermaid
code block, and they will be rendered as diagrams:
Graphs:
graph LR
hello --> world
world --> again
again --> hello
Sequence diagrams:
sequenceDiagram
autonumber
Alice->>John: Hello John, how are you?
loop Healthcheck
John->>John: Fight against hypochondria
end
Note right of John: Rational thoughts!
John-->>Alice: Great!
John->>Bob: How about you?
Bob-->>John: Jolly good!
Class diagrams:
classDiagram
Person <|-- Student
Person <|-- Professor
Person : +String name
Person : +String phoneNumber
Person : +String emailAddress
Person: +purchaseParkingPass()
Address "1" <-- "0..1" Person:lives at
class Student{
+int studentNumber
+int averageMark
+isEligibleToEnrol()
+getSeminarsTaken()
}
class Professor{
+int salary
}
class Address{
+String street
+String city
+String state
+int postalCode
+String country
-validate()
+outputAsLabel()
}
Tooltips
Tooltips and other such "admonitions" can be written with a !!!
block:
Note
This is a note.
Tip
This is a tip.
Warning
Be careful!
Danger
This is dangerous!
Code blocks
Specify python with the "py" shortcode after the 3 backticks.
You can highlight lines too with hl_lines="3-5"
def divide(a: float, b: float) -> float:
"""
Return the division of two numbers. Raise an error if dividing by zero.
Args:
a (float): The numerator.
b (float): The denominator.
Returns:
float: The result of the division.
Raises:
ValueError: If the denominator is zero.
"""
if b == 0:
raise ValueError("Cannot divide by zero.")
return a / b
Inline code blocks can be highlighted for specific languages by prefixing #!python
: lambda a: print(a)
Content tabs
Content tabs can be used to show different versions of something in a tabbed layout:
It doesn't have to be code:
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci
- Sed sagittis eleifend rutrum
- Donec vitae suscipit est
- Nulla tempor lobortis orci