From 9497067c8f050df3fc5402ff42c78976608b410c Mon Sep 17 00:00:00 2001 From: Brad Treloar Date: Sun, 2 Mar 2025 00:25:37 +1030 Subject: [PATCH] WIP custom theme --- mkdocs.yml | 6 ++-- notes_theme/README.md | 3 ++ notes_theme/base.html | 29 +++++++++++++++++++ notes_theme/css/main.css | 51 ++++++++++++++++++++++++++++++++++ notes_theme/main-menu-sub.html | 14 ++++++++++ notes_theme/main-menu.html | 19 +++++++++++++ notes_theme/main.html | 1 + 7 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 notes_theme/README.md create mode 100644 notes_theme/base.html create mode 100644 notes_theme/css/main.css create mode 100644 notes_theme/main-menu-sub.html create mode 100644 notes_theme/main-menu.html create mode 100644 notes_theme/main.html diff --git a/mkdocs.yml b/mkdocs.yml index c68ea1d..46dcbad 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,2 +1,4 @@ -site_name: My Docs -theme: readthedocs +site_name: Notes +theme: + name: null + custom_dir: ./notes_theme diff --git a/notes_theme/README.md b/notes_theme/README.md new file mode 100644 index 0000000..af67020 --- /dev/null +++ b/notes_theme/README.md @@ -0,0 +1,3 @@ +# Notes mkdocs theme + +Help: [Creating a custom theme](https://www.mkdocs.org/dev-guide/themes/#creating-a-custom-theme) diff --git a/notes_theme/base.html b/notes_theme/base.html new file mode 100644 index 0000000..5706ca5 --- /dev/null +++ b/notes_theme/base.html @@ -0,0 +1,29 @@ + + + + + {% if page.title %}{{ page.title }} - {% endif %}{{ config.site_name }} + + + + + + {%- for path in config.extra_css %} + + {%- endfor %} + + + + + {% include "main-menu.html" %} + +
+ {{ page.content }} +
+ + {%- for script in config.extra_javascript %} + {{ script | script_tag }} + {%- endfor %} + + + diff --git a/notes_theme/css/main.css b/notes_theme/css/main.css new file mode 100644 index 0000000..53829b1 --- /dev/null +++ b/notes_theme/css/main.css @@ -0,0 +1,51 @@ +:root { + --gutter: 1rem; +} + +* { + box-sizing: border-box; +} + +html, +body { + margin: 0; + padding: 0; + font-family: Arial, Helvetica, sans-serif; + font-size: 16px; +} + +main { + margin: 0 auto; + padding: 0 var(--gutter); + width: 100%; + box-sizing: content-box; + max-width: 600px; +} + +.main-menu { + background-color: #eee; + position: fixed; + top: 0; + bottom: 0; + left: 0; + padding: var(--gutter); +} + +.main-menu__top-level-items, +.main-menu__sub-level-items { + list-style: none; + padding: 0; +} + +.main-menu__sub-menu { + padding: 0 0 0 var(--gutter); +} + +.main-menu__top-level-items { + margin: 0; +} + +.main-menu__top-level-item { + margin: 0; +} + diff --git a/notes_theme/main-menu-sub.html b/notes_theme/main-menu-sub.html new file mode 100644 index 0000000..432a215 --- /dev/null +++ b/notes_theme/main-menu-sub.html @@ -0,0 +1,14 @@ +{% if not nav_item.children %} + +{% else %} + +{% endif %} diff --git a/notes_theme/main-menu.html b/notes_theme/main-menu.html new file mode 100644 index 0000000..b39212c --- /dev/null +++ b/notes_theme/main-menu.html @@ -0,0 +1,19 @@ + diff --git a/notes_theme/main.html b/notes_theme/main.html new file mode 100644 index 0000000..94d9808 --- /dev/null +++ b/notes_theme/main.html @@ -0,0 +1 @@ +{% extends "base.html" %}