this repo has no description
1
fork

Configure Feed

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

Add docsite shell plugin and expose structured sidebar data

Extend the odoc shell plugin interface with a sidebar_data field that
provides the raw Odoc_document.Sidebar.t alongside the pre-rendered HTML
sidebar. This allows shell plugins to generate custom sidebar UIs from
structured data rather than being limited to the default HTML rendering.

Create the odoc-docsite shell plugin (--shell docsite) that generates a
docs.rs-inspired documentation website with a fixed header, interactive
sidebar with package selector, full-text search, SPA navigation, dark
mode, and responsive layout. The sidebar JSON is embedded inline in each
page for client-side rendering.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+14 -4
+7 -4
src/html/generator.ml
··· 658 658 let subpages = subpages ~config ~sidebar @@ Doctree.Subpages.compute p in 659 659 let resolve = Link.Current url in 660 660 let breadcrumbs = Breadcrumbs.gen_breadcrumbs ~config ~sidebar ~url in 661 - let sidebar = 661 + let sidebar_html = 662 662 match sidebar with 663 663 | None -> None 664 664 | Some sidebar -> ··· 688 688 | None -> Html_shell.default () 689 689 in 690 690 Shell.make ~config 691 - { url; header; preamble; content; breadcrumbs; toc; sidebar; 691 + { url; header; preamble; content; breadcrumbs; toc; 692 + sidebar = sidebar_html; sidebar_data = sidebar; 692 693 uses_katex; source_anchor; resources; assets; children = subpages } 693 694 694 695 and source_page ~config ~sidebar sp = 695 696 let { Source_page.url; contents } = sp in 696 697 let resolve = Link.Current sp.url in 697 698 let breadcrumbs = Breadcrumbs.gen_breadcrumbs ~config ~sidebar ~url in 698 - let sidebar = 699 + let sidebar_html = 699 700 match sidebar with 700 701 | None -> None 701 702 | Some sidebar -> ··· 717 718 | Some shell -> shell 718 719 | None -> Html_shell.default () 719 720 in 720 - Shell.make_src ~config { url; header; breadcrumbs; sidebar; title; content = [ doc ] } 721 + Shell.make_src ~config 722 + { url; header; breadcrumbs; sidebar = sidebar_html; 723 + sidebar_data = sidebar; title; content = [ doc ] } 721 724 end 722 725 723 726 let render ~config ~sidebar = function
+2
src/html/html_shell.ml
··· 10 10 breadcrumbs : Types.breadcrumbs; 11 11 toc : Types.toc list; 12 12 sidebar : Html_types.div_content Html.elt list option; 13 + sidebar_data : Odoc_document.Sidebar.t option; 13 14 uses_katex : bool; 14 15 source_anchor : string option; 15 16 resources : Odoc_extension_registry.resource list; ··· 22 23 header : Html_types.flow5_without_header_footer Html.elt list; 23 24 breadcrumbs : Types.breadcrumbs; 24 25 sidebar : Html_types.div_content Html.elt list option; 26 + sidebar_data : Odoc_document.Sidebar.t option; 25 27 title : string; 26 28 content : Html_types.div_content Html.elt list; 27 29 }
+2
src/html/html_shell.mli
··· 16 16 breadcrumbs : Types.breadcrumbs; 17 17 toc : Types.toc list; 18 18 sidebar : Html_types.div_content Html.elt list option; 19 + sidebar_data : Odoc_document.Sidebar.t option; 19 20 uses_katex : bool; 20 21 source_anchor : string option; 21 22 resources : Odoc_extension_registry.resource list; ··· 29 30 header : Html_types.flow5_without_header_footer Html.elt list; 30 31 breadcrumbs : Types.breadcrumbs; 31 32 sidebar : Html_types.div_content Html.elt list option; 33 + sidebar_data : Odoc_document.Sidebar.t option; 32 34 title : string; 33 35 content : Html_types.div_content Html.elt list; 34 36 }
+3
src/html/odoc_html.ml
··· 7 7 module Html_page = Html_page 8 8 (** @canonical Odoc_html.Html_page *) 9 9 10 + module Html_shell = Html_shell 11 + (** @canonical Odoc_html.Html_shell *) 12 + 10 13 module Generator = Generator 11 14 module Link = Link 12 15 module Json = Odoc_utils.Json