From 8aa0a4842bce99382200e3ffc525b2a498202742 Mon Sep 17 00:00:00 2001 From: Paul-Elliot Date: Fri, 3 May 2024 08:23:27 +0200 Subject: [PATCH] Add clarifying comment for search links Signed-off-by: Paul-Elliot --- src/search/html.ml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/search/html.ml b/src/search/html.ml index 49e19ed6d1..3219c37ba1 100644 --- a/src/search/html.ml +++ b/src/search/html.ml @@ -5,7 +5,19 @@ open Lang let url { Entry.id; kind; doc = _ } = let open Entry in - let stop_before = match kind with Doc _ -> false | _ -> true in + let stop_before = + (* Some module/module types/... might not have an expansion, so we need to + be careful and set [stop_before] to [true] for those, to avoid linking to + an inexistant page. + + Docstring do not have an ID in the model, and use the ID from the parent + signature in search entries. Therefore, links to doc comments need + [stop_before] to be [false] to point to the page where they are present. + + Values, types, ... are not sensitive to [stop_before]. + *) + match kind with Doc _ -> false | _ -> true + in match Odoc_document.Url.from_identifier ~stop_before id with | Ok url -> let config =