this repo has no description
1
fork

Configure Feed

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

WIP: site redesign, odoc extension API updates, and new content

- odoc extension API: add link-phase enrichment support for extensions
- odoc-jons-plugins: new site shell with nav bar, recent posts with
featured card layout, and updated CSS
- site-builder: support projects/ directory and improved rule generation
- site: redesigned homepage with hero section and recent posts cards
- site: updated blog index layout
- onnxrt docs: minor .mld cleanup
- New blog images and content (weeknotes, examination map, fungus svg)
- Add mockup.html for design iteration

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

+74 -5
+1 -1
src/extension_api/dune
··· 1 1 (library 2 2 (name odoc_extension_api) 3 3 (public_name odoc.extension_api) 4 - (libraries odoc_model odoc_document odoc_extension_registry)) 4 + (libraries odoc_model odoc_document odoc_extension_registry odoc_xref2))
+40
src/extension_api/odoc_extension_api.ml
··· 105 105 (** Raised when an extension receives a tag variant it doesn't support *) 106 106 exception Unsupported_tag of string 107 107 108 + (** {1 Link Environment} 109 + 110 + Extensions that need to look up other pages or modules during linking 111 + can use the cross-reference environment. *) 112 + 113 + module Env = Odoc_xref2.Env 114 + 108 115 (** {1 Extension Interface} *) 109 116 110 117 (** The signature that all tag extensions must implement *) ··· 120 127 (** Document phase: convert tag to renderable content. 121 128 Called during document generation. Returns content plus any 122 129 page-level resources needed (JS/CSS). *) 130 + end 131 + 132 + (** Extensions that also need link-time access to the cross-reference 133 + environment implement this extended signature. *) 134 + module type Extension_with_link = sig 135 + include Extension 136 + 137 + val link : 138 + tag:string -> 139 + Env.t -> 140 + Comment.nestable_block_element Location_.with_location list -> 141 + Comment.nestable_block_element Location_.with_location list 142 + (** Link phase: transform tag content with access to the cross-reference 143 + environment. Called during linking, after references have been resolved. 144 + Use [Env.lookup_page_by_name] etc. to look up other pages. *) 123 145 end 124 146 125 147 (** {1 Code Block Extensions} ··· 195 217 with Unsupported_tag _ -> None 196 218 in 197 219 Odoc_extension_registry.register_handler ~prefix:E.prefix handler 220 + 221 + let register_with_link (module E : Extension_with_link) = 222 + let handler tag content = 223 + try 224 + let result = E.to_document ~tag content in 225 + Some { 226 + Odoc_extension_registry.content = result.content; 227 + overrides = result.overrides; 228 + resources = result.resources; 229 + assets = result.assets; 230 + } 231 + with Unsupported_tag _ -> None 232 + in 233 + Odoc_extension_registry.register_handler ~prefix:E.prefix handler; 234 + let link_handler tag env content = 235 + E.link ~tag (Obj.obj env) content 236 + in 237 + Odoc_extension_registry.register_link_handler ~prefix:E.prefix link_handler 198 238 199 239 let register_code_block (module E : Code_Block_Extension) = 200 240 let handler meta content =
+22
src/extension_registry/odoc_extension_registry.ml
··· 213 213 let list_extension_infos () = 214 214 Hashtbl.fold (fun _ info acc -> info :: acc) extension_infos [] 215 215 |> List.sort (fun a b -> String.compare a.info_prefix b.info_prefix) 216 + 217 + (** {1 Link Handlers} 218 + 219 + Extensions can register a link handler that runs during the linking 220 + phase with access to the cross-reference environment. The handler 221 + receives the tag name, the environment (as [Obj.t] to avoid a 222 + dependency on [odoc_xref2] here), and already-resolved content. 223 + It returns transformed content. *) 224 + 225 + type link_handler = 226 + string -> (* tag name *) 227 + Obj.t -> (* env — actually Odoc_xref2.Env.t, type-erased *) 228 + Comment.nestable_block_element Location_.with_location list -> 229 + Comment.nestable_block_element Location_.with_location list 230 + 231 + let link_handlers : (string, link_handler) Hashtbl.t = Hashtbl.create 16 232 + 233 + let register_link_handler ~prefix (handler : link_handler) = 234 + Hashtbl.replace link_handlers prefix handler 235 + 236 + let find_link_handler ~prefix = 237 + Hashtbl.find_opt link_handlers prefix
+1 -1
src/xref2/dune
··· 3 3 (public_name odoc.xref2) 4 4 (instrumentation 5 5 (backend landmarks --auto)) 6 - (libraries odoc_model odoc_utils)) 6 + (libraries odoc_model odoc_utils odoc_extension_registry)) 7 7 8 8 (rule 9 9 (enabled_if
+10 -3
src/xref2/link.ml
··· 344 344 and comment_tag env warnings_tag parent ~loc:_ (x : Comment.tag) = 345 345 match x with 346 346 | `Custom (name, content) -> 347 - `Custom 348 - ( name, 349 - comment_nestable_block_element_list env warnings_tag parent content ) 347 + let resolved = 348 + comment_nestable_block_element_list env warnings_tag parent content 349 + in 350 + let prefix = Odoc_extension_registry.prefix_of_tag name in 351 + let content = 352 + match Odoc_extension_registry.find_link_handler ~prefix with 353 + | Some handler -> handler name (Obj.repr env) resolved 354 + | None -> resolved 355 + in 356 + `Custom (name, content) 350 357 | `Deprecated content -> 351 358 `Deprecated 352 359 (comment_nestable_block_element_list env warnings_tag parent content)