From f6b15f28ac77e0044fff12f1c765b910a8d3aa68 Mon Sep 17 00:00:00 2001 From: blissful Date: Tue, 25 Jun 2024 19:05:09 -0400 Subject: [PATCH] toc to the side --- flake.nix | 1 + scripts/build.py | 4 +- src/assets/css/global.css | 2 +- src/assets/css/post.css | 38 +++++++++++++++++-- src/{head.jinja => head.html.jinja} | 0 src/{index.jinja => index.html.jinja} | 2 +- src/posts/{template.jinja => post.html.jinja} | 6 +-- src/posts/tex/common.sty | 2 +- 8 files changed, 43 insertions(+), 12 deletions(-) rename src/{head.jinja => head.html.jinja} (100%) rename src/{index.jinja => index.html.jinja} (98%) rename src/posts/{template.jinja => post.html.jinja} (93%) diff --git a/flake.nix b/flake.nix index 23b1f75..cf4e099 100644 --- a/flake.nix +++ b/flake.nix @@ -12,6 +12,7 @@ pkgs = import nixpkgs { inherit system; }; tex = pkgs.texlive.combine { inherit (pkgs.texlive) scheme-small + latexmk amsmath dirtree ellipsis diff --git a/scripts/build.py b/scripts/build.py index e268529..7360ffc 100755 --- a/scripts/build.py +++ b/scripts/build.py @@ -111,7 +111,7 @@ def compile_favicons(): def compile_index(posts: PostIndex, commit: str): - with Path("src/index.jinja").open("r") as fp: + with Path("src/index.html.jinja").open("r") as fp: tpl = je.from_string(fp.read()) # Write the main index.html @@ -129,7 +129,7 @@ def compile_index(posts: PostIndex, commit: str): def compile_posts(posts: PostIndex, commit: str): Path("dist/posts").mkdir() - with Path("src/posts/template.jinja").open("r") as fp: + with Path("src/posts/post.html.jinja").open("r") as fp: tpl = je.from_string(fp.read()) for f in Path("src/posts/tex").iterdir(): if not f.suffix == ".tex": diff --git a/src/assets/css/global.css b/src/assets/css/global.css index ebd18a9..8f6294a 100644 --- a/src/assets/css/global.css +++ b/src/assets/css/global.css @@ -151,7 +151,7 @@ html { --color-bg-base: #f6f5f4; --color-bg-nested: #f5f3ef; --color-fg-primary: #000000; - --color-fg-secondary: #605b53; + --color-fg-secondary: #464138; --color-border-primary: #c5b194; --color-border-secondary: #ece8e2; diff --git a/src/assets/css/post.css b/src/assets/css/post.css index c68a532..0cc2dbb 100644 --- a/src/assets/css/post.css +++ b/src/assets/css/post.css @@ -3,6 +3,14 @@ content: "."; } +.pandoc a[href^="#"] { + color: var(--color-fg-primary); +} + +.column { + max-width: 36rem; +} + .pandoc #TOC { padding: 1rem; margin-bottom: 1.5rem; @@ -24,6 +32,32 @@ color: var(--color-fg-primary); } +@media screen and (min-width: 1200px) { + .column { + max-width: 62rem; + } + + .pandoc { + display: flex; + flex-direction: row-reverse; + gap: 4rem; + } + .pandoc #TOC { + flex: 0 0 20rem; + height: fit-content; + position: sticky; + top: 2rem; + max-height: calc(100vh - 4rem); + overflow-y: auto; + } + .pandoc #TOC a { + color: var(--color-fg-secondary); + } + .pandoc #POST { + flex: 0 0 38rem; + } +} + .pandoc h1, .pandoc h2, .pandoc h3, @@ -80,7 +114,3 @@ font-size: var(--font-size-xs); color: var(--color-fg-secondary); } - -.pandoc a[href^="#"] { - color: var(--color-fg-primary); -} diff --git a/src/head.jinja b/src/head.html.jinja similarity index 100% rename from src/head.jinja rename to src/head.html.jinja diff --git a/src/index.jinja b/src/index.html.jinja similarity index 98% rename from src/index.jinja rename to src/index.html.jinja index 4a6bda6..2418e60 100644 --- a/src/index.jinja +++ b/src/index.html.jinja @@ -1,7 +1,7 @@ - {% include "head.jinja" %} + {% include "head.html.jinja" %} sunset glow diff --git a/src/posts/template.jinja b/src/posts/post.html.jinja similarity index 93% rename from src/posts/template.jinja rename to src/posts/post.html.jinja index 42ca744..53e780e 100644 --- a/src/posts/template.jinja +++ b/src/posts/post.html.jinja @@ -1,7 +1,7 @@ - {% include "head.jinja" %} + {% include "head.html.jinja" %} {% if meta.fascicle %} {{ meta.fascicle.index }}. {{ meta.fascicle.title }} | @@ -11,8 +11,8 @@ <link rel="stylesheet" type="text/css" href="/assets/css/post.css?v={{ commit }}" /> </head> <body> - <div class="w-content mx-auto p-8"> - <div class="max-w-36"> + <div class="w-content mx-auto py-8 px-6"> + <div class="column"> <div class="text-sm label mono"><a class="decoration-none fg-primary" href="/">sunset glow</a></div> <div class="py-16" /> <div class="flex flex-col gap-4"> diff --git a/src/posts/tex/common.sty b/src/posts/tex/common.sty index e91a227..26aae62 100644 --- a/src/posts/tex/common.sty +++ b/src/posts/tex/common.sty @@ -3,7 +3,7 @@ \RequirePackage{enumitem} \RequirePackage{hyperref} -\RequirePackage{lstlisting} +\RequirePackage{listings} \newcommand{\ti}{\textit} \newcommand{\tb}{\textbf}