this repo has no description
0
fork

Configure Feed

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

Add Copy_from support file variant and configurable x-ocaml URLs

Support files can now either embed inline string content (Inline) or
reference a file path on disk to copy (Copy_from). This enables large
binary-like files such as x-ocaml.js (~16MB) to be managed via
`odoc support-files` without embedding them as OCaml string literals.

The scrollycode extension's x-ocaml script URLs are now configurable
via ODOC_X_OCAML_JS and ODOC_X_OCAML_WORKER environment variables,
and ODOC_X_OCAML_JS_PATH registers the file as a Copy_from support file.

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

+22 -5
+21 -4
src/scrollycode_extension.ml
··· 698 698 Buffer.add_string buf "</script>\n"; 699 699 700 700 (* x-ocaml for playground *) 701 - Buffer.add_string buf {|<script src="/_x-ocaml/x-ocaml.js" src-worker="/_x-ocaml/worker.js" backend="jtw"></script> 702 - |}; 701 + let x_ocaml_js_url = 702 + match Sys.getenv_opt "ODOC_X_OCAML_JS" with 703 + | Some url -> url 704 + | None -> "/_x-ocaml/x-ocaml.js" 705 + in 706 + let x_ocaml_worker_url = 707 + match Sys.getenv_opt "ODOC_X_OCAML_WORKER" with 708 + | Some url -> url 709 + | None -> "/_x-ocaml/worker.js" 710 + in 711 + Printf.bprintf buf {|<script src="%s" src-worker="%s" backend="jtw"></script> 712 + |} x_ocaml_js_url x_ocaml_worker_url; 703 713 704 714 Buffer.contents buf 705 715 ··· 737 747 Odoc_extension_api.Registry.register (module Scrolly); 738 748 Odoc_extension_api.Registry.register_support_file ~prefix:"scrolly" { 739 749 filename = "extensions/scrollycode.css"; 740 - content = Scrollycode_css.structural_css; 741 - } 750 + content = Inline Scrollycode_css.structural_css; 751 + }; 752 + (match Sys.getenv_opt "ODOC_X_OCAML_JS_PATH" with 753 + | Some path -> 754 + Odoc_extension_api.Registry.register_support_file ~prefix:"scrolly" { 755 + filename = "_x-ocaml/x-ocaml.js"; 756 + content = Copy_from path; 757 + } 758 + | None -> ())
+1 -1
src/scrollycode_themes.ml
··· 521 521 let register name content = 522 522 Odoc_extension_api.Registry.register_support_file ~prefix:"scrolly" { 523 523 filename = "extensions/scrollycode-" ^ name ^ ".css"; 524 - content; 524 + content = Inline content; 525 525 } 526 526 in 527 527 register "warm" warm_css;