From ea802aa91e40ea6150773d4c7618f450a64a8ca8 Mon Sep 17 00:00:00 2001 From: Damien Date: Thu, 22 Jul 2021 00:38:53 +0200 Subject: docs: Setup mkdocs with mkdocs-material theme This changes the framework used to generate the klipper3d site. Signed-off-by: Damien Martin --- docs/_config.yml | 4 - docs/_klipper3d/css/extra.css | 15 ++++ docs/_klipper3d/mkdocs-requirements.txt | 8 ++ docs/_klipper3d/mkdocs_hooks.py | 18 +++++ docs/_layouts/README | 5 -- docs/_layouts/default.html | 139 -------------------------------- docs/_layouts/home.html | 16 ---- docs/img/favicon.ico | Bin 0 -> 8222 bytes docs/index.md | 1 - 9 files changed, 41 insertions(+), 165 deletions(-) delete mode 100644 docs/_config.yml create mode 100644 docs/_klipper3d/css/extra.css create mode 100644 docs/_klipper3d/mkdocs-requirements.txt create mode 100644 docs/_klipper3d/mkdocs_hooks.py delete mode 100644 docs/_layouts/README delete mode 100644 docs/_layouts/default.html delete mode 100644 docs/_layouts/home.html create mode 100644 docs/img/favicon.ico (limited to 'docs') diff --git a/docs/_config.yml b/docs/_config.yml deleted file mode 100644 index 9daee3ca..00000000 --- a/docs/_config.yml +++ /dev/null @@ -1,4 +0,0 @@ -# This is a Jekyll config file that is used by "github pages" to -# produce the https://www.klipper3d.org/ website. -include: CONTRIBUTING.md -google_analytics: UA-138371409-1 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"\\", "
", 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 diff --git a/docs/_layouts/README b/docs/_layouts/README deleted file mode 100644 index 266b60e4..00000000 --- a/docs/_layouts/README +++ /dev/null @@ -1,5 +0,0 @@ -This directory defines the https://www.klipper3d.org/ website. The -site is hosted using "github pages" (which uses Jekyll to -automatically convert the markdown files in the docs/ directory to -html). In addition to the files in this directory, the docs/CNAME and -docs/_config.yml file also control the website generation. diff --git a/docs/_layouts/default.html b/docs/_layouts/default.html deleted file mode 100644 index 5bbb3cca..00000000 --- a/docs/_layouts/default.html +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - {% seo %} - - - - - - - - - - - - -
-
- - - - - -
-
- {{ content }} -
-
- -
-
- - - {% if site.google_analytics %} - - {% endif %} - - - - - - - - - - - - - - diff --git a/docs/_layouts/home.html b/docs/_layouts/home.html deleted file mode 100644 index 6f213fd0..00000000 --- a/docs/_layouts/home.html +++ /dev/null @@ -1,16 +0,0 @@ ---- -# This file defines the main https://www.klipper3d.org/ page. -layout: default ---- -

- -

Klipper is a 3d-Printer firmware. It combines the power of a general -purpose computer with one or more micro-controllers. See the -features document for more information on why you -should use Klipper.

- -

To begin using Klipper start by installing it.

- -

Klipper is Free Software. Read the documentation or -view -the Klipper code on github.

diff --git a/docs/img/favicon.ico b/docs/img/favicon.ico new file mode 100644 index 00000000..fae28463 Binary files /dev/null and b/docs/img/favicon.ico differ diff --git a/docs/index.md b/docs/index.md index 4e221914..37eca645 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,5 @@ --- hide: - - navigation - toc title: Welcome --- -- cgit v1.2.3-70-g09d2