Skip to content

Commit

Permalink
docs: Setup mkdocs with mkdocs-material theme
Browse files Browse the repository at this point in the history
This changes the framework used to generate the klipper3d site.

Signed-off-by: Damien Martin <damlobster@gmail.com>
  • Loading branch information
damlobster committed Jul 23, 2021
1 parent 0a5752d commit a3da9bb
Show file tree
Hide file tree
Showing 9 changed files with 169 additions and 160 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/klipper3d-deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: klipper3d deploy
on:
push:
branches:
- docs-mkdocs
paths:
- docs/**
- mkdocs.yml
- .github/workflows/klipper3d-deploy.yaml
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- uses: actions/cache@v2
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('docs/_klipper3d/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: pip install -r docs/_klipper3d/mkdocs-requirements.txt
- name: Build and deploy klipper3d
run: |
mkdocs gh-deploy --force --remote-branch gh-pages --verbose
15 changes: 15 additions & 0 deletions docs/_klipper3d/css/extra.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[data-md-color-scheme="slate"] {
--md-primary-fg-color: hsla(var(--md-hue),15%,12%,1);
--md-default-bg-color: hsla(var(--md-hue),17%,17%,1);
--md-typeset-a-color: steelblue;
--md-accent-fg-color: lightblue;
}

img {
background-color: white;
}

.center-image {
margin: 0 auto;
display: block;
}
6 changes: 6 additions & 0 deletions docs/_klipper3d/mkdocs-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
mkdocs==1.2.2
mkdocs-material==7.2.0
mkdocs-section-index==0.3.1
mkdocs-simple-hooks==0.1.3
mkdocs-exclude==1.0.2
mdx-truly-sane-lists==1.2
3 changes: 3 additions & 0 deletions docs/_klipper3d/mkdocs_hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

def rewrite_github_links(markdown: str, page, config, files):
return markdown.replace('](../', f"]({config['repo_url']}blob/master/")
5 changes: 0 additions & 5 deletions docs/_layouts/README

This file was deleted.

139 changes: 0 additions & 139 deletions docs/_layouts/default.html

This file was deleted.

16 changes: 0 additions & 16 deletions docs/_layouts/home.html

This file was deleted.

Binary file added docs/img/favicon.ico
Binary file not shown.
116 changes: 116 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
site_name: Klipper documentation
theme:
name: material
palette:
- media: "(prefers-color-scheme: light)"
scheme: default
primary: white
accent: blue
toggle:
icon: material/lightbulb
name: Switch to dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: grey
accent: light blue
toggle:
icon: material/lightbulb-outline
name: Switch to light mode
# primary: white
# accent: blue
logo: img/klipper.svg
favicon: img/favicon.ico
icon:
repo: fontawesome/brands/github
features:
- navigation.instant
#- navigation.tabs
#- navigation.expand
- navigation.top
# if enabled, the TOC doesn't work for some pages
# - toc.integrate
- search.suggest
- search.highlight
- search.share
extra_css:
- _klipper3d/css/extra.css
repo_url: https://github.com/KevinOConnor/klipper
repo_name: KevinOConnor/klipper
edit_uri: blob/master/docs/
plugins:
- search
- section-index
- mkdocs-simple-hooks:
hooks:
on_page_markdown: "docs._klipper3d.mkdocs_hooks:rewrite_github_links"
- exclude:
glob:
- README.md
markdown_extensions:
- toc:
permalink: True
toc_depth: 6
#- pymdownx.snippets
- attr_list
- mdx_truly_sane_lists
extra:
analytics:
# https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#site-search-tracking
provider: google
property: UA-131268251-1
# version:
# provider: mike
nav:
- Overview:
- Overview.md
- Features.md
- FAQ.md
- Releases.md
- Config_Changes.md
- Contact.md
- Configuration and Tuning:
- Installation.md
- Configuration reference:
- Config_Reference.md
- Rotation_Distance.md
- Config_checks.md
- Bed level:
- Bed_Level.md
- Delta_Calibrate.md
- Probe_Calibrate.md
- BLTouch.md
- Manual_Level.md
- Bed_Mesh.md
- Endstop_Phase.md
- Resonance compensation:
- Resonance_Compensation.md
- Measuring_Resonances.md
- Pressure_Advance.md
- Slicers.md
- Command templates:
- Command_Templates.md
- Status_Reference.md
- TMC_Drivers.md
- skew_correction.md
- Using_PWM_Tools.md
- G-Codes.md
- Developer documentation:
- Code_Overview.md
- Kinematics.md
- Protocol.md
- API_Server.md
- MCU_Commands.md
- CANBUS_protocol.md
- Debugging.md
- Benchmarks.md
- CONTRIBUTING.md
- Packaging.md
- Device specific documents:
- Example_Configs.md
- SDCard_Updates.md
- RPi_microcontroller.md
- beaglebone.md
- Bootloaders.md
- CANBUS.md
- TSL1401CL_Filament_Width_Sensor.md
- HallFilamentWidthSensor.md

0 comments on commit a3da9bb

Please sign in to comment.