MkDocs Quickstart GuideΒΆ
This guide will get you up and running with the MkDocs documentation system for Retail AI in just a few minutes.
What is MkDocs?ΒΆ
MkDocs is a fast, simple static site generator that builds beautiful documentation from Markdown files. Your Retail AI project uses MkDocs with the Material theme for a modern, professional documentation experience.
π Quick Setup (2 minutes)ΒΆ
Step 1: Install DependenciesΒΆ
Choose one of these methods:
Step 2: Start the Development ServerΒΆ
Or directly:
Step 3: Open Your BrowserΒΆ
Navigate to: http://localhost:8000
π That's it! Your documentation is now running locally.
π Creating Your First PageΒΆ
1. Create a New Markdown FileΒΆ
2. Add ContentΒΆ
# My First Guide
This is my first documentation page!
## Features
- Easy to write in Markdown
- Live preview with auto-reload
- Beautiful Material Design theme
## Code Examples
```python
def hello_world():
print("Hello, MkDocs!")
Next StepsΒΆ
- Tools Overview
- Quick Start
### 3. Add to Navigation Edit `mkdocs.yml` and add your page to the navigation: ```yaml nav: - Home: index.md - Getting Started: - Quick Start: getting-started/quick-start.md - MkDocs Guide: getting-started/mkdocs-quickstart.md - User Guides: - My First Guide: guides/my-first-guide.md # Add this line
4. See Your ChangesΒΆ
The page will automatically appear in your browser at http://localhost:8000
π¨ Styling and FeaturesΒΆ
Admonitions (Callout Boxes)ΒΆ
!!! note "Pro Tip"
This creates a blue info box
!!! warning "Important"
This creates a yellow warning box
!!! danger "Critical"
This creates a red danger box
!!! success "Great Job"
This creates a green success box
Result:
Pro Tip
This creates a blue info box
Code Blocks with Syntax HighlightingΒΆ
```python title="example.py"
def find_product(sku: str) -> dict:
"""Find a product by SKU."""
return {"sku": sku, "name": "Coffee Pods"}
### Tabbed Content
```markdown
=== "Python"
```python
print("Hello from Python!")
```
=== "JavaScript"
```javascript
console.log("Hello from JavaScript!");
```
=== "Bash"
```bash
echo "Hello from Bash!"
```
Result:
Mermaid DiagramsΒΆ
π§ Essential CommandsΒΆ
Development CommandsΒΆ
| Command | Purpose | When to Use |
|---|---|---|
make docs-serve |
Start development server | Writing documentation |
make docs-build |
Build static site | Testing before deploy |
make docs-deploy |
Deploy to GitHub Pages | Publishing changes |
make docs-clean |
Clean build files | Troubleshooting |
Advanced CommandsΒΆ
# Build with strict mode (fails on warnings)
mkdocs build --strict
# Serve on different port
mkdocs serve --dev-addr=127.0.0.1:8001
# Build to custom directory
mkdocs build --site-dir custom-site
# Deploy with custom message
mkdocs gh-deploy --message "Updated documentation"
π File OrganizationΒΆ
Recommended StructureΒΆ
docs/
βββ index.md # Homepage
βββ getting-started/ # Getting started guides
β βββ quick-start.md
β βββ installation.md
β βββ mkdocs-quickstart.md
βββ tools/ # Tool documentation
β βββ overview.md
β βββ unity-catalog-functions.md
βββ guides/ # User guides
β βββ store-manager.md
βββ development/ # Developer docs
β βββ setup.md
βββ api/ # API reference
β βββ functions.md
βββ examples/ # Examples and tutorials
βββ basic-usage.md
File Naming ConventionsΒΆ
- Use lowercase with hyphens:
my-awesome-guide.md - Be descriptive:
unity-catalog-functions.mdnotuc-funcs.md - Group related files in directories
- Use
index.mdfor directory landing pages
π Linking Between PagesΒΆ
Relative LinksΒΆ
# Link to another page
[Quick Start Guide](../getting-started/quick-start.md)
# Link to a section
[Unity Catalog Functions](../agents-and-tools/overview.md#unity-catalog-functions)
# Link to external site
[MkDocs Documentation](https://www.mkdocs.org/)
Navigation LinksΒΆ
Links in the navigation are automatically generated from your mkdocs.yml configuration.
π― Best PracticesΒΆ
Writing TipsΒΆ
- Start with an outline - Plan your page structure first
- Use headings hierarchically - H1 β H2 β H3, don't skip levels
- Include code examples - Show, don't just tell
- Add cross-references - Link to related pages
- Keep paragraphs short - Easier to read online
Technical TipsΒΆ
- Test your links - Use
mkdocs build --strictto catch broken links - Optimize images - Keep file sizes reasonable
- Use consistent formatting - Follow the existing style
- Preview before committing - Always check in the browser first
π Publishing Your DocumentationΒΆ
Automatic Deployment (Recommended)ΒΆ
Your project is set up with GitHub Actions for automatic deployment:
- Push to main branch
- GitHub Actions builds and deploys automatically
- Documentation is live at your GitHub Pages URL
Manual DeploymentΒΆ
π TroubleshootingΒΆ
Common IssuesΒΆ
Port already in use
Broken links warning
Changes not showing
Build fails
Getting HelpΒΆ
- Check the MkDocs logs in your terminal
- Validate your YAML configuration
- Test with
mkdocs build --strict - Check the MkDocs documentation
π Next StepsΒΆ
Now that you know the basics:
- Explore the Material theme features: Material for MkDocs
- Add more content to your documentation
- Customize the theme in
mkdocs.yml - Set up automatic deployment with GitHub Actions
- Share your documentation with your team
π You're Ready!ΒΆ
You now have everything you need to create beautiful documentation with MkDocs. Start writing, and remember:
- Keep it simple - Markdown is easy to learn
- Focus on content - The theme handles the styling
- Iterate quickly - Use the live preview to see changes instantly
- Have fun - Good documentation makes everyone's life easier!
Happy documenting! πβ¨