replace styled components

This commit is contained in:
tristan 2024-01-01 06:33:57 +00:00
parent 003100e691
commit 30ffa6c9b3
11 changed files with 388 additions and 444 deletions

View file

@ -1,4 +1,15 @@
let elems = import ./elems.nix;
let
elems = import ./elems.nix;
html = import ./html.nix;
H = n:
let
v = if n < 1 then
builtins.trace "attempted to make heading size ${n} (min is 1)" 1
else if n > 6 then
builtins.trace "attempted to make heading size ${n} (max is 6)" 6
else
n;
in html.tag "h${toString v}" { };
in rec {
readMd = md:
if builtins.isPath md then
@ -30,13 +41,14 @@ in rec {
readDir = root: recFixAppendix (recReadMd root);
mdToPage = md: elems.Doc [ [ (elems.title "markdown file") ] (readMd md) ];
mdToPage = md:
elems.Doc { } [ [ (elems.title { } "markdown file") ] (readMd md) ];
mdBlock = block:
let
m = heading block;
h = if m == null then 0 else builtins.stringLength (builtins.elemAt m 0);
in if m == null then elems.p { } block else elems.H h (builtins.elemAt m 1);
in if m == null then elems.p { } block else H h (builtins.elemAt m 1);
heading = block: builtins.match "(#+) (.*)" block;
}