Authoring Content with Markdown and MkDocs Material¶
This guide provides a brief overview of writing content using Markdown and leveraging the styling capabilities of the MkDocs Material theme for your Changemaker documentation site.
Markdown Basics¶
Markdown is a lightweight markup language with plain-text formatting syntax. It's designed to be easy to read and write.
Headings¶
Emphasis¶
Lists¶
Ordered List:
Unordered List:
Links¶
[Link Text](https://www.example.com)
[Link with Title](https://www.example.com "An example link")
[Relative Link to another page](../apps/code-server.md)
Images¶
Place your images in themkdocs/docs/assets/images/
directory (or create it if it doesn't exist) and reference them accordingly.
Code Blocks¶
Inline Code:
Use backticks: this is inline code
.
Fenced Code Blocks (Recommended for multi-line code): Specify the language for syntax highlighting.
Blockquotes¶
Horizontal Rule¶
Tables¶
| Header 1 | Header 2 | Header 3 |
| :------- | :------: | -------: |
| Align L | Center | Align R |
| Cell 1 | Cell 2 | Cell 3 |
MkDocs Material Theme Features¶
MkDocs Material provides many enhancements and custom syntax options on top of standard Markdown.
Admonitions (Call-outs)¶
These are great for highlighting information.
!!! note
This is a note.
!!! tip "Optional Title"
Here's a helpful tip!
!!! warning
Be careful with this action.
!!! danger "Critical Alert"
This is a critical warning.
!!! abstract "Summary"
This is an abstract or summary.
Supported types include: note
, abstract
, info
, tip
, success
, question
, warning
, failure
, danger
, bug
, example
, quote
.
Code Blocks with Titles and Line Numbers¶
Your mkdocs.yml
is configured for pymdownx.highlight
which supports this.
Emojis¶
Your mkdocs.yml
has pymdownx.emoji
enabled.
Footnotes¶
Your mkdocs.yml
has footnotes
enabled.
Content Tabs¶
Group related content under tabs.
=== "Tab 1 Title"
Content for tab 1 (can be Markdown)
=== "Tab 2 Title"
Content for tab 2
```python
# Code blocks work here too
print("Hello from Tab 2")
```
Task Lists¶
Styling with Attributes (attr_list
)¶
You can add CSS classes or IDs to elements.
This is a paragraph with a custom class.
{: .my-custom-class }
## A Heading with an ID {#custom-heading-id}
extra.css
file.
Buttons¶
MkDocs Material has a nice way to create buttons from links:
[This is a button link](https://example.com){ .md-button }
[Primary button](https://example.com){ .md-button .md-button--primary }
[Another button](another-page.md){ .md-button }
Editing Workflow¶
- Use Code Server: Access Code Server from your Changemaker dashboard.
- Navigate: Open the
mkdocs/docs/
directory. - Create or Edit: Create new
.md
files or edit existing ones. - Save: Save your changes (
Ctrl+S
orCmd+S
). - Preview:
- If you have
mkdocs serve
running (either locally on your machine if developing there, or in a terminal within Code Server pointing to themkdocs
directory), your documentation site (usually athttp://localhost:8000
orhttp://127.0.0.1:8000
) will auto-reload. - Alternatively, you can use VS Code extensions like "Markdown Preview Enhanced" within Code Server for a live preview pane.
- If you have
Further Reading¶
- MkDocs Material Reference: The official documentation for all features.
- Markdown Guide: For general Markdown syntax.
This guide should give you a solid start. Explore the MkDocs Material documentation for even more advanced features like diagrams, math formulas, and more complex page layouts.