This commit is contained in:
tristan 2024-01-02 09:33:56 +00:00
parent 195f8a60ae
commit b1426fb1ca
7 changed files with 28 additions and 20 deletions

View file

@ -1,5 +1,4 @@
let
elems = import ./elems.nix;
let elems = import ./elems.nix;
in rec {
readMd = md:
if builtins.isPath md then
@ -66,7 +65,7 @@ in rec {
(let
m = builtins.match regex block;
before = let v = builtins.elemAt m 0; in if v == null then "" else v;
after = toString( builtins.elemAt m (matchCount - 1));
after = toString (builtins.elemAt m (matchCount - 1));
matchCount = builtins.length m;
in if m == null then
block
@ -97,14 +96,11 @@ in rec {
(basicRule (wrap "~~") elems.del)
(basicRule (wrap "\\*\\*") elems.strong)
(basicRule (wrapBreak "__") elems.strong)
(rule (contains "\\[(.*)]\\((.*)\\)") (
m:
(rule (contains "\\[(.*)]\\((.*)\\)") (m:
let
href = builtins.elemAt m 2;
text = builtins.elemAt m 1;
in
(elems.a href text)
))
in (elems.a href text)))
(rule (''
(.*
)([^-][^
@ -127,8 +123,15 @@ in rec {
}) [ m ])) [ (builtins.elemAt l 2) ]))
))
(basicRule ( "(.*\n\n)?(.+)\n(.*)?" ) elems.p)
(basicRule ("(.*\n\n)?```(.*)```(.*)?") (elems.textarea { readonly = true; }))
(basicRule (''
(.*
)?(.+)
(.*)?'') elems.p)
(basicRule (''
(.*
)?```(.*)```(.*)?'') (elems.textarea { readonly = true; }))
(basicRule (containsBreak ''
###### ([^
]+)'') (elems.h6))