Ocamldoc vs odoc right align

Hello

I currently use old ocamldoc to produce my doc.
In trying to switch to odoc, I get the following error when running dune build @doc:

File "lib/bogue.mli", line 36, characters 0-25:
'{R {{:graph-b_utils.html}': bad markup.
Suggestion: did you mean '{!R {{:graph-b_utils.html}' or '[R {{:graph-b_utils.html]'?

So I gather that the {R} tag for right alignement is not supported by odoc. Before I dig deeper, what would be the right way to achieve this? I’d be happy, for instance, to have a CSS class and style it in the style.css file.

I don’t think you’ll like the answer but I suggest you don’t try to do these kind of things. These tweaks will not work in centralized (e.g. the mythical docs.ocaml.org) or personal (e.g. odiged opam switches) docsets which the most likely way your users will eventually read your documentation.

I see what you mean. So what I just did is to use a (probably?) uncommon section level, {9}, to style it with align-right. In this way, if others use a different css style, it will be located elsewhere, but that’ not a big deal; at least I get rid of the error. Do you see any potential danger of doing this?

edit: oops I spoke too fast. Section {9} is allowed by ocamldoc but not by odoc. I will have to use {5}.

edit2: forget it:

'{{:...} ...}' (external link) is not allowed in '{5 ...}' (section heading).

sorry for the noise

Btw, in the odoc doc

maybe we could indicate which features mentionned in

http://caml.inria.fr/pub/docs/manual-ocaml/ocamldoc.html#sec357

are actually not supported by odoc.

No danger but I think you should rather work with the medium and its conventions (i.e. all headings in general will be styled on the same side of the page) than try to go against it.

That I consider a bug :–)

1 Like