From 78a96c5c5a0289d17c0f8be4fa3eef955c780f5c Mon Sep 17 00:00:00 2001 From: Matt Sturgeon Date: Tue, 6 May 2025 00:42:19 +0100 Subject: [PATCH] doc: fix longestFence usage of lib.max (#1231) Fixes: 6e55a89494c0 ("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> --- docs/default.nix | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/docs/default.nix b/docs/default.nix index d0171356..3f441fc2 100644 --- a/docs/default.nix +++ b/docs/default.nix @@ -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