Skip to content

Commit e9eb727

Browse files
Julowpanglesd
authored andcommitted
Doc: parent-child convention for installed packages
This convention is already in use by Odig, Voodoo and Dune. It needs to be specified as it needs to change in order to support assets and complex hierarchies. Co-authored-by: Paul-Elliot <[email protected]>
1 parent 07169c8 commit e9eb727

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

doc/parent_child_spec.mld

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{0 Parent/Child Specification}
22
This parent/child specification allows more flexible output support, e.g., per library documentation. See {{:https://ocaml.org/packages}ocaml.org/packages}.
33

4+
{1 Rules}
5+
46
The rules are;
57

68
{ul
@@ -19,6 +21,8 @@ The rules are;
1921
{b Note:} The [--pkg <package>] option is still supported for backward compatibility in [odoc >= v2.0.0],
2022
although it's now equivalent to specifying a parent [.mld] file.
2123

24+
{1 Example}
25+
2226
For example, let's consider [John] whose is [Doe] and [Mark]'s father. [Doe] has
2327
children, [Max], and page [foo], whereas [Mark] has no children. That is to say,
2428
[john.mld], [doe.mld], [mark.mld], [max.mld], [foo.ml] respectively. For instance;
@@ -157,3 +161,34 @@ and we shall get
157161
]}
158162

159163
For more about [odoc] commands, simply invoke [odoc --help] in your shell.
164+
165+
{1 Convention for installed packages}
166+
167+
Locally, the build system can make arbitrary complex documentation page
168+
hierarchies.
169+
However, the generated HTML documentation is generally not installed as part of
170+
a package. Instead the documentation source code made of [.mld] pages is
171+
installed and might be used by a different driver.
172+
173+
{2 Convention}
174+
175+
In order for drivers to build consistent documentation for a package, the
176+
following convention should be followed.
177+
178+
- [.mld] pages are installed in a package's [share] directory, under the
179+
[odoc-pages] sub-directory.
180+
- [index.mld] is the parent of every other pages. The driver can freely rename
181+
this page, for example, it can be named after the package.
182+
- Other pages are children of the [index.mld] page.
183+
184+
If no [index.mld] is installed, it's the driver's responsibility to generate
185+
it.
186+
187+
When the rendering of source code is enabled, the source tree will be named
188+
[source] and will be a child of [index.mld]. As a consequence, no page can be
189+
named [source.mld].
190+
191+
This convention is followed by the drivers
192+
{{:https://erratique.ch/software/odig/doc/packaging.html}Odig}
193+
and {{:https://github.com/ocaml-doc/voodoo}ocaml.org}
194+
and by the build system {{:https://github.com/ocaml/dune}Dune}.

0 commit comments

Comments
 (0)