diff options
author | Damien <damlobster@gmail.com> | 2021-07-22 00:38:53 +0200 |
---|---|---|
committer | KevinOConnor <kevin@koconnor.net> | 2021-07-27 13:15:25 -0400 |
commit | ea802aa91e40ea6150773d4c7618f450a64a8ca8 (patch) | |
tree | 014a45597172073ff4511a936d01465671cd9046 /docs/_klipper3d | |
parent | cff61605fb7260ab60d1abd4e295b71a533869ac (diff) | |
download | kutter-ea802aa91e40ea6150773d4c7618f450a64a8ca8.tar.gz kutter-ea802aa91e40ea6150773d4c7618f450a64a8ca8.tar.xz kutter-ea802aa91e40ea6150773d4c7618f450a64a8ca8.zip |
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>
Diffstat (limited to 'docs/_klipper3d')
-rw-r--r-- | docs/_klipper3d/css/extra.css | 15 | ||||
-rw-r--r-- | docs/_klipper3d/mkdocs-requirements.txt | 8 | ||||
-rw-r--r-- | docs/_klipper3d/mkdocs_hooks.py | 18 |
3 files changed, 41 insertions, 0 deletions
diff --git a/docs/_klipper3d/css/extra.css b/docs/_klipper3d/css/extra.css new file mode 100644 index 00000000..0bdfed47 --- /dev/null +++ b/docs/_klipper3d/css/extra.css @@ -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; +}
\ No newline at end of file diff --git a/docs/_klipper3d/mkdocs-requirements.txt b/docs/_klipper3d/mkdocs-requirements.txt new file mode 100644 index 00000000..6afd2723 --- /dev/null +++ b/docs/_klipper3d/mkdocs-requirements.txt @@ -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 diff --git a/docs/_klipper3d/mkdocs_hooks.py b/docs/_klipper3d/mkdocs_hooks.py new file mode 100644 index 00000000..5b122a1d --- /dev/null +++ b/docs/_klipper3d/mkdocs_hooks.py @@ -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 |