mirror of
https://github.com/Klipper3d/klipper.git
synced 2025-07-14 18:28:00 -06:00
docs: Setup mkdocs with mkdocs-material theme
This changes the framework used to generate the klipper3d site. Signed-off-by: Damien Martin <damlobster@gmail.com>
This commit is contained in:
parent
cff61605fb
commit
ea802aa91e
11 changed files with 189 additions and 165 deletions
15
docs/_klipper3d/css/extra.css
Normal file
15
docs/_klipper3d/css/extra.css
Normal file
|
@ -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;
|
||||
}
|
8
docs/_klipper3d/mkdocs-requirements.txt
Normal file
8
docs/_klipper3d/mkdocs-requirements.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
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
|
||||
mdx-breakless-lists==1.0.1
|
||||
py-gfm==1.0.2
|
18
docs/_klipper3d/mkdocs_hooks.py
Normal file
18
docs/_klipper3d/mkdocs_hooks.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import re
|
||||
|
||||
def transform(markdown: str, page, config, files):
|
||||
in_list = False
|
||||
lines = markdown.splitlines()
|
||||
for i in range(len(lines)):
|
||||
lines[i] = lines[i].replace('](../',
|
||||
f"]({config['repo_url']}blob/master/")
|
||||
lines[i] = re.sub(r"\\", "<br>", lines[i])
|
||||
# check that lists at level 0 are not indented (no space before *|-|1.)
|
||||
if len(lines[i]) == 0:
|
||||
in_list = False
|
||||
elif re.match(r"^(\*|-|\d+\.) ", lines[i]):
|
||||
in_list = True
|
||||
if not in_list:
|
||||
lines[i] = re.sub(r"^\s+(\*|-|\d+\.) ", r"\1 ", lines[i])
|
||||
output = "\n".join(lines)
|
||||
return output
|
Loading…
Add table
Add a link
Reference in a new issue