Skip to content

Commit

Permalink
Add clarifying comment for search links
Browse files Browse the repository at this point in the history
Signed-off-by: Paul-Elliot <[email protected]>
  • Loading branch information
panglesd committed May 3, 2024
1 parent f5c61fa commit 8aa0a48
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/search/html.ml
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down

0 comments on commit 8aa0a48

Please sign in to comment.