this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Sherlodoc Phase 2: per-heading entries for mld pages

Extend from_page in skeleton.ml to emit one child entry per heading
in addition to the whole-page entry. Each heading entry uses the
heading's Label.t identifier (which carries the fragment anchor) and
stores the heading text as its doc content for tokenisation.

Before: searching for a word returns only the page.
After: searching returns the page AND the specific heading, with a
qualified name that includes the anchor (e.g.
ht.heading-test.section-about-parseff).

Verified via sherlodoc index + search on a test fixture with two
headings: "section about parseff" and "section about tessera". Each
heading appears as a separate search result, and searching for
"section" returns both headings.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+23 -2
+23 -2
src/index/skeleton.ml
··· 148 148 149 149 let of_docs id source_loc doc = 150 150 Entry.entry ~id ~doc:doc.elements ~kind:Doc ~source_loc 151 + 152 + let of_heading label_id inline_content location = 153 + let doc = 154 + [ { Odoc_model.Location_.value = `Paragraph inline_content; 155 + location } ] 156 + in 157 + Entry.entry ~id:label_id ~doc ~kind:Doc ~source_loc:None 151 158 end 152 159 153 160 let if_non_hidden id f = ··· 338 345 let from_page (p : Page.t) = 339 346 match p with 340 347 | { name; content; _ } -> 341 - let entry = Entry.of_docs name None content in 342 - Tree.leaf entry 348 + let page_entry = Entry.of_docs name None content in 349 + (* Phase 2: emit one child entry per heading so sherlodoc can 350 + index heading text and deep-link to the anchor. The heading's 351 + Label.t identifier carries the fragment anchor. *) 352 + let heading_children = 353 + List.filter_map 354 + (fun (el : Odoc_model.Comment.block_element 355 + Odoc_model.Location_.with_location) -> 356 + match el.value with 357 + | `Heading (_, label_id, inline_content) -> 358 + Some (Tree.leaf 359 + (Entry.of_heading label_id inline_content el.location)) 360 + | _ -> None) 361 + content.elements 362 + in 363 + { Tree.node = page_entry; children = heading_children }