doc: fix longestFence usage of lib.max (#1231)

Fixes: 6e55a89494 ("doc: ensure code blocks are safely fenced (#1218)")
Link: https://github.com/danth/stylix/pull/1231

Reviewed-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
This commit is contained in:
Matt Sturgeon 2025-05-06 00:42:19 +01:00 committed by GitHub
parent 6e55a89494
commit 78a96c5c5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -306,8 +306,10 @@ let
remainingStr = builtins.elemAt groups 1;
prevLen = builtins.stringLength prev;
currLen = builtins.stringLength current;
longest = lib.max currLen prevLen;
# Reduce to the longest of `prev` & `current`
longest = if currLen > prevLen then current else prev;
in
# If no more matches for "`", return; otherwise keep looking
if groups == null then prev else longestFence' longest remainingStr;
# Renders a value, which should have been created with either lib.literalMD