Skip to content

Commit f3c982e

Browse files
committed
Deploying to gh-pages from @ c4a4277 🚀
1 parent df95df5 commit f3c982e

45 files changed

Lines changed: 2771 additions & 4 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

dev/index.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# OCaml Package Documentation
2+
3+
- [wodoc](wodoc/index.md)

dev/llms-full.txt

Lines changed: 1284 additions & 0 deletions
Large diffs are not rendered by default.

dev/llms.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Wodoc
2+
3+
> *wodoc* (web \+ odoc) is an [odoc](https://github.com/ocaml/odoc) driver that builds complete, styled **websites** from `.mld` and `.mli` sources — not just API documentation.
4+
5+
## Manual
6+
- [Wodoc](wodoc/index.md)
7+
- [How wodoc works](wodoc/overview.md)
8+
- [Directives](wodoc/directives.md)
9+
- [Authoring: what survives on ocaml.org](wodoc/authoring.md)
10+
- [Configuration: the `doc/wodoc` file](wodoc/config.md)
11+
- [Commands](wodoc/commands.md)
12+
- [Adding a blog](wodoc/blog.md)
13+
- [API reference](wodoc/api.md)
14+
- [OCaml Package Documentation](index.md)
15+
16+
## API
17+
- [Module `Assemble.Parts`](wodoc/Wodoc-Assemble-Parts.md)
18+
- [Module `Wodoc.Assemble`](wodoc/Wodoc-Assemble.md)
19+
- [Module `Wodoc.Blog`](wodoc/Wodoc-Blog.md)
20+
- [Module `Wodoc.Build`](wodoc/Wodoc-Build.md)
21+
- [Module `Wodoc.Config`](wodoc/Wodoc-Config.md)
22+
- [Module `Wodoc.Convert`](wodoc/Wodoc-Convert.md)
23+
- [Module `Wodoc.Llms`](wodoc/Wodoc-Llms.md)
24+
- [Module `Wodoc.Nav`](wodoc/Wodoc-Nav.md)
25+
- [Module `Wodoc.Preprocess`](wodoc/Wodoc-Preprocess.md)
26+
- [Module `Wodoc.Render`](wodoc/Wodoc-Render.md)
27+
- [Module `Wodoc.Resolve`](wodoc/Wodoc-Resolve.md)
28+
- [Module `Wodoc.Sexp`](wodoc/Wodoc-Sexp.md)
29+
- [Module `Wodoc`](wodoc/Wodoc.md)

dev/wodoc/Wodoc-Assemble-Parts.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
# Module `Assemble.Parts`
3+
4+
```ocaml
5+
type t = {
6+
title : string; (* plain text of the page's <h1> *)
7+
preamble : string; (* the odoc-preamble header, verbatim *)
8+
toc : string; (* the odoc-tocs block, verbatim (may be empty) *)
9+
content : string; (* the odoc-content block, verbatim *)
10+
}
11+
```
12+
```ocaml
13+
val of_odoc_html : string -> t
14+
```
15+
Extract the parts from a full odoc-generated HTML page.

dev/wodoc/Wodoc-Assemble.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
2+
# Module `Wodoc.Assemble`
3+
4+
Assembly layer: wrap odoc's rendered HTML in a project-provided site template.
5+
6+
wodoc stays generic: the project owns all of its chrome (header, menus, drawer, footer, version selector) as a plain HTML *template* with named holes. This module only:
7+
8+
- extracts the meaningful parts from odoc's HTML output ([`Parts.of_odoc_html`](./Wodoc-Assemble-Parts.md#val-of_odoc_html));
9+
- fills the holes of the template ([`fill`](./#val-fill));
10+
- marks the current navigation entry ([`mark_current`](./#val-mark_current)).
11+
A template is HTML containing holes written `{{name}}`. The standard holes filled by [`page`](./#val-page) are `{{base}}`, `{{title}}`, `{{preamble}}`, `{{toc}}` and `{{content}}`. Menu links carry a `data-wodoc-page` attribute; the entry whose value equals the current page id receives the `current` class.
12+
13+
```ocaml
14+
module Parts : sig ... end
15+
```
16+
```ocaml
17+
val fill : template:string -> (string * string) list -> string
18+
```
19+
`fill ~template bindings` replaces every `{{key}}` in `template` with its bound value. Unbound holes are left untouched.
20+
21+
```ocaml
22+
val mark_current :
23+
?attr:string ->
24+
?class_:string ->
25+
current:string ->
26+
string ->
27+
string
28+
```
29+
`mark_current ~current html` adds `class_` (default `"current"`) to every start tag whose `attr` (default `"data-wodoc-page"`) equals `current`, merging with an existing `class`. `current = ""` marks nothing.
30+
31+
```ocaml
32+
val page :
33+
?preamble:bool ->
34+
?flat:bool ->
35+
?strip_anchors:bool ->
36+
?base:string ->
37+
?menu:string ->
38+
?subproject:string ->
39+
?menu_current:string ->
40+
?leftnav:string ->
41+
?mdlink:string ->
42+
template:string ->
43+
current:string ->
44+
string ->
45+
string
46+
```
47+
`page ~template ~current odoc_html` builds a full page: extract the odoc parts, [`Render.html`](./Wodoc-Render.md#val-html) the content fragment (the template chrome is never rendered), fill the template holes, then [`mark_current`](./#val-mark_current).
48+
49+
- `preamble` (default `true`): fill `{{preamble}}` with the page `<h1>` title block; pass `false` for pages that should not show a title.
50+
- `flat` (default `false`): for full-width pages whose containers span the odoc preamble/content boundary, concatenate the inner preamble and content (dropping odoc's wrappers) into `{{content}}` and leave `{{preamble}}` empty.
51+
- `strip_anchors` (default `true`): drop odoc's heading hover-anchors.
52+
- `base` (default `""`): fills `{{base}}`, the relative path from the page to the doc root (e.g. `"."`, `".."`, `"../.."`), so a version's internal links stay within that version and never mention it.
53+
- `menu` (default `""`): fills `{{menu}}` with the shared site menu fragment (header, top menu, drawer). The fragment may carry its own holes (`{{subproject}}`, `{{base}}`, `{{leftnav}}`); the first two are filled here, `{{leftnav}}` is left for the caller. Lets every page share one menu source.
54+
- `subproject` (default `""`): fills `{{subproject}}` (the sub-project name shown next to the Ocsigen logo); empty on the vitrine.
55+
- `menu_current` (default `""`): like `current` but for the menu's current *project* entry (`data-wodoc-page=<project>`), kept separate from `current` so a project page can highlight both its menu entry and its in-page nav.
56+
- `leftnav` (default `""`): fills every `{{leftnav}}` hole (the drawer's mobile menu and the left column share one source), so the navigation is defined once instead of being `sed`\-expanded into both slots.
57+
- `mdlink` (default `""`): fills `{{mdlink}}` with the page's `<link rel="alternate" type="text/markdown">` element pointing at its Markdown twin (or `""` when there is no twin), so AIs/LLMs can discover the `.md` version of any page.

dev/wodoc/Wodoc-Blog.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
2+
# Module `Wodoc.Blog`
3+
4+
```ocaml
5+
type post = {
6+
date : string; (* publication date "YYYY-MM-DD", taken from the file name *)
7+
slug : string; (* the file-name part after the date, e.g. "first-post" *)
8+
src : string; (* path to the post's .mld source *)
9+
path : string; (* deployed page path, relative to the version root, e.g. "blog/first-post.html" *)
10+
title : string; (* the post's {1 …} / {0 …} heading, as plain text *)
11+
author : string; (* odoc @author …, plain text ("" when absent) *)
12+
excerpt : string; (* first paragraph of the body, plain text (may be "") *)
13+
}
14+
```
15+
```ocaml
16+
val posts : Config.blog -> post list
17+
```
18+
`posts blog`: the posts found in `blog.dir` (file names `YYYY-MM-DD-slug.mld`), newest first. Files that do not match the dated naming are skipped.
19+
20+
```ocaml
21+
val nav_section : Config.blog -> post list -> Config.section
22+
```
23+
`nav_section blog posts`: a synthetic left-nav [`Config.section`](./Wodoc-Config.md#type-section) listing the posts (heading `blog.heading`, one link per post), to splice into the config nav. The link label is "date — title".
24+
25+
```ocaml
26+
val nav_html : base:string -> Config.blog -> post list -> string
27+
```
28+
`nav_html ~base blog posts`: the blog's left-nav block as a `<nav class="api-nav manual-nav">` (an `<h3>` \+ one `<li>` per post), rendered like a manual nav section so the shared CSS styles it. For the low-level `wodoc assemble --leftnav` path; the turn-key `wodoc build` path splices [`nav_section`](./#val-nav_section) instead. `base` is the page's relative path to the blog root.
29+
30+
```ocaml
31+
val feed :
32+
base_url:string ->
33+
blog_path:string ->
34+
feed_path:string ->
35+
title:string ->
36+
author:string ->
37+
post list ->
38+
string
39+
```
40+
`feed ~base_url ~blog_path ~feed_path ~title ~author posts`: an Atom feed of the posts (newest first), for syndication (e.g. OCaml Planet). `base_url` is the site origin; a post's URL is `base_url ^ blog_path ^ "/" ^ post.path`; the feed advertises itself at `base_url ^ feed_path`. Entry bodies are the post excerpt as an HTML summary; the feed `updated` is the newest post's date.
41+
42+
```ocaml
43+
val latest_fragment : base:string -> Config.blog -> post list -> string
44+
```
45+
`latest_fragment ~base blog posts`: the HTML fragment that the `{%wodoc:blog-latest%}` marker expands to — a `<ul class="wodoc-blog-list">` of the `blog.latest` most recent posts (title, date, author, excerpt, link), each link prefixed with `base` (the per-page relative root). Empty when there are no posts.
46+
47+
```ocaml
48+
val marker : string
49+
```
50+
the marker the landing uses to request [`latest_fragment`](./#val-latest_fragment). wodoc rewrites `{%wodoc:blog-latest%}` to this HTML comment in [`Preprocess`](./Wodoc-Preprocess.md); [`expand`](./#val-expand) turns it back into the fragment.
51+
52+
```ocaml
53+
val expand : fragment:string -> string -> string
54+
```
55+
`expand ~fragment html`: replace every [`marker`](./#val-marker) comment in `html` with `fragment`. A no-op when the page carries no marker.

dev/wodoc/Wodoc-Build.md

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
2+
# Module `Wodoc.Build`
3+
4+
```ocaml
5+
val read_file : string -> string
6+
```
7+
```ocaml
8+
val write_file : string -> string -> unit
9+
```
10+
```ocaml
11+
val is_url : string -> bool
12+
```
13+
```ocaml
14+
val origin_of : string -> string option
15+
```
16+
```ocaml
17+
val read_menu : string -> string
18+
```
19+
```ocaml
20+
val mkdir_p : string -> unit
21+
```
22+
```ocaml
23+
val html_files : string -> string -> string list
24+
```
25+
```ocaml
26+
val base_of : string -> string
27+
```
28+
```ocaml
29+
val replace_hole : string -> string -> string -> string
30+
```
31+
```ocaml
32+
val esc : string -> string
33+
```
34+
```ocaml
35+
val default_highlight : string
36+
```
37+
```ocaml
38+
val template : ?body_extra:string -> ?extra_script:string -> Config.t -> string
39+
```
40+
```ocaml
41+
val docversion : latest:string option -> string list -> string
42+
```
43+
```ocaml
44+
val page_toc : string
45+
```
46+
```ocaml
47+
val nav_href : string -> string
48+
```
49+
```ocaml
50+
val nav_link : int -> Config.entry -> string
51+
```
52+
```ocaml
53+
val render_items : Stdlib.Buffer.t -> int -> Config.item list -> unit
54+
```
55+
```ocaml
56+
val manual_nav : Config.t -> string
57+
```
58+
```ocaml
59+
val leftnav : latest:string option -> Config.t -> string list -> string
60+
```
61+
```ocaml
62+
val latest_target : root:string -> string option
63+
```
64+
```ocaml
65+
val compare_version : string -> string -> int
66+
```
67+
```ocaml
68+
val version_names : root:string -> ?extra:string list -> unit -> string list
69+
```
70+
```ocaml
71+
val versions : out:string -> label:string -> string list
72+
```
73+
```ocaml
74+
val write_manifest : root:string -> unit
75+
```
76+
```ocaml
77+
val asset_re : Str.regexp
78+
```
79+
```ocaml
80+
val local_assets : menu:string -> out:string -> unit
81+
```
82+
```ocaml
83+
val cs_switch : Config.cs_side list -> string
84+
```
85+
```ocaml
86+
val cs_switch_script : Config.t -> Config.cs_side list -> string
87+
```
88+
```ocaml
89+
val cs_leftnav :
90+
latest:string option ->
91+
versions:string list ->
92+
switch:string ->
93+
manual_nav:string ->
94+
api_nav:string ->
95+
string
96+
```
97+
```ocaml
98+
val topdir : string -> string option
99+
```
100+
```ocaml
101+
val side_for : Config.cs_side list -> string -> Config.cs_side option
102+
```
103+
```ocaml
104+
val side_of : Config.cs_side list -> string -> string
105+
```
106+
```ocaml
107+
val drop_prefix : string -> string -> string
108+
```
109+
```ocaml
110+
val cs_current : Config.cs_side list -> string -> string
111+
```
112+
```ocaml
113+
val nav_entry_paths : Config.t -> string list
114+
```
115+
```ocaml
116+
val strip_index : string -> string
117+
```
118+
```ocaml
119+
val current_of_page : string -> string list -> string
120+
```
121+
```ocaml
122+
val md_twin : string -> string
123+
```
124+
```ocaml
125+
val md_alternate :
126+
md_src:string option ->
127+
base:string ->
128+
rel:string ->
129+
orel:string ->
130+
string
131+
```
132+
```ocaml
133+
val nav_md_order : Config.t -> string list
134+
```
135+
```ocaml
136+
val run :
137+
Config.t ->
138+
src:string ->
139+
md_src:string option ->
140+
out:string ->
141+
label:string ->
142+
menu:string ->
143+
assets_dir:string ->
144+
local:bool ->
145+
set_latest:bool ->
146+
unit
147+
```
148+
```ocaml
149+
val release : site:string -> from:string -> version:string -> unit
150+
```

0 commit comments

Comments
 (0)