Deployed dc7b02f with MkDocs version: 1.2.3

This commit is contained in:
2022-04-06 13:35:20 +00:00
commit a109567020
278 changed files with 263821 additions and 0 deletions

Binary file not shown.

16
_klipper3d/css/extra.css Normal file
View File

@@ -0,0 +1,16 @@
/* Customization of mkdocs generated site */
[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;
}

View File

@@ -0,0 +1,29 @@
#!/bin/bash
# Modify the file structure before running mkdocs
# This is a make shift script before the current structure of
# Klipper-translations can be directly utilized by mkdocs
git clone --depth 1 https://github.com/Klipper3d/klipper-translations
while IFS="," read dirname langname langdesc note; do
# move and rename markdown files
local_dir="klipper-translations/docs/locales/$dirname"
echo "Moving $dirname to $langname"
for file in "$local_dir"/*.md; do
mdfilename="${file/$local_dir\//}"
mv "$file" "./docs/${mdfilename//.md/.${langname}.md}"
done
# manually replace index.md if a manual-index.md exist
manual_index="./docs/manual-index.$langname.md"
if [[ -f "$manual_index" ]];then
mv "$manual_index" "./docs/index.${langname}.md"
echo "replaced index.${langname}.md with $manual_index"
else
echo "Manually translated index file for $dirname not found!"
fi
# add to translations.yml
echo " ${langname}: ${langdesc}" >> ./docs/_klipper3d/translations.yml
done < <(egrep -v '^ *(#|$)' ./klipper-translations/active_translations)

6
_klipper3d/index Normal file
View File

@@ -0,0 +1,6 @@
This directory defines the https://www.klipper3d.org/ website. The
site is hosted using "github pages". The
.github/workflows/klipper3d-deploy.yaml tool uses mkdocs (
https://www.mkdocs.org/ ) to automatically convert the markdown files
in the docs/ directory to html. In addition to the files in this
directory, the docs/CNAME file also controls the website generation.

View File

@@ -0,0 +1,10 @@
# Python virtualenv module requirements for mkdocs
jinja2==3.0.3
mkdocs==1.2.3
mkdocs-material==8.1.3
mkdocs-simple-hooks==0.1.3
mkdocs-exclude==1.0.2
mdx-truly-sane-lists==1.2
mdx-breakless-lists==1.0.1
py-gfm==1.0.2
mkdocs-static-i18n==0.30

126
_klipper3d/mkdocs.yml Normal file
View File

@@ -0,0 +1,126 @@
# Main configuration file for mkdocs generation of klipper3d.org website
# Site and directory configuration
site_name: Klipper documentation
repo_url: https://github.com/Klipper3d/klipper
repo_name: Klipper3d/klipper
edit_uri: blob/master/docs/
use_directory_urls: False
docs_dir: '../'
site_dir: '../../site/'
INHERIT: translations.yml
# Markdown document translation settings
markdown_extensions:
- toc:
permalink: True
toc_depth: 6
- attr_list
- mdx_partial_gfm
- mdx_truly_sane_lists
- mdx_breakless_lists
plugins:
search: {}
mkdocs-simple-hooks:
hooks:
on_page_markdown: "docs._klipper3d.mkdocs_hooks:transform"
exclude:
glob: "README.md"
# Website layout configuration (using mkdocs-material theme)
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
logo: img/klipper.svg
favicon: img/favicon.ico
icon:
repo: fontawesome/brands/github
alternate: material/web
features:
#- 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
# Site usage statistics
extra:
# https://squidfunk.github.io/mkdocs-material/setup/setting-up-site-analytics/#site-search-tracking
analytics:
provider: google
property: UA-138371409-1
# Navigation hierarchy (this should mimic the layout of Overview.md)
nav:
- Overview.md
- Features.md
- FAQ.md
- Releases.md
- Config_Changes.md
- Contact.md
- Installation and Configuration:
- 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
- G-Codes.md
- Command templates:
- Command_Templates.md
- Status_Reference.md
- TMC_Drivers.md
- Multi_MCU_Homing.md
- Slicers.md
- Skew_Correction.md
- Using_PWM_Tools.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
- Hall_Filament_Width_Sensor.md

View File

@@ -0,0 +1,42 @@
# Tool to customize conversion of markdown files during mkdocs site generation
import re
import logging
# This script translates some github specific markdown formatting to
# improve rendering with mkdocs. The goal is for pages to render
# similarly on both github and the web site. It has three main tasks:
# 1. Convert links outside of the docs directory (any reference
# starting with "../") to an absolute link to the raw file on
# github.
# 2. Convert a trailing backslash on a text line to a "<br>".
# 3. Remove leading spaces from top-level lists so that those lists
# are rendered correctly.
logger = logging.getLogger('mkdocs.mkdocs_hooks.transform')
def transform(markdown: str, page, config, files):
in_code_block = 0
in_list = False
lines = markdown.splitlines()
for i in range(len(lines)):
line_out = lines[i]
in_code_block = (in_code_block +
len(re.findall("\s*[`]{3,}", line_out))) % 2
if not in_code_block:
line_out = line_out.replace('](../',
f"]({config['repo_url']}blob/master/")
line_out = re.sub("\\\s*$", "<br>", line_out)
# check that lists at level 0 are not indented
# (no space before *|-|1.)
if re.match(r"^[^-*0-9 ]", line_out):
in_list = False
elif re.match(r"^(\*|-|\d+\.) ", line_out):
in_list = True
if not in_list:
line_out = re.sub(r"^\s+(\*|-|\d+\.) ", r"\1 ", line_out)
if line_out != lines[i]:
logger.debug((f'[mkdocs_hooks] rewrite line {i+1}: '
f'"{lines[i]}" -> "{line_out}"'))
lines[i] = line_out
output = "\n".join(lines)
return output

View File

@@ -0,0 +1,7 @@
# Klipper3d.org language translation template file.
# Actual language definitions are appended by the fetch-translations.sh script.
plugins:
i18n:
default_language: en
languages:
en: English