# \`{!Ocaml\_operators}\` in different styles

**URL:** <https://discuss.ocaml.org/t/ocaml-operators-in-different-styles/10096>\
**Category:** Learning\
**Tags:** documentation\
**Created:** [June 29, 2022, 6:24pm UTC](https://discuss.ocaml.org/t/ocaml-operators-in-different-styles/10096 "2022-06-29T18:24:22Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![muzimuzhi](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/muzimuzhi/32/4185_2.png) [@muzimuzhi](https://discuss.ocaml.org/u/muzimuzhi)\
**Post date:** [June 29, 2022, 6:24pm UTC](https://discuss.ocaml.org/t/ocaml-operators-in-different-styles/10096/1 "2022-06-29T18:24:22Z")

</div>

On doc page [OCaml library : Stdlib](https://v2.ocaml.org/releases/4.14/api/Stdlib.html#1_Booleanoperations), v4.14

- When used in a normal doc entry, the interpreted result of `{!Ocaml_operators}` has a background color.
- When used in a doc entry for deprecated operator (maybe also functions and types, not checked), there’s no background color.

Is this difference on purpose?

PS: It seems this difference came with the current html design, which is deployed since v4.12.

PS2: You won’t find docs for `Stdlib.( & )` and `Stdlib.( | )` in the latest codebase because they were already removed in preparation for release v5.0.0, see [Remove deprecated functions by nojb · Pull Request #10867 · ocaml/ocaml · GitHub](https://github.com/ocaml/ocaml/pull/10867/files#diff-4b2076f71b548f2c277d781ca848c9af9ebbd1d776425f75ce4a8c98c9362bb2) .

 ![image](https://us1.discourse-cdn.com/flex020/uploads/ocaml/original/2X/6/639cf3f94cccf41ce4a19f243dbe66f3482f6bd7.png)

* * *

From browser’s “Inspect” utility, I find docs for normal operator are wrapped in a `<p>` tag which then meet the `background-color` css set for `.api p code`. Docs for deprecated operators are not wrapped in a `<p>` tag, hence the `<code>` has no background color.

```xml
<div class="api">
  <!-- doc for normal operator, for example Stdlib.(&&) -->
  <div class="info ">
    <div class="info-desc">
      <p> [...], see <a href="Ocaml_operators.html">
        <code class="code">
          <span class="constructor">Ocaml_operators</span>
        </code>
      </a> for more information.</p>
    </div>
  </div>
  
  <!-- doc for deprecated operator, for example Stdlib.(&) -->
  <div class="info ">
    <div class="info-deprecated">
      [...], see <a href="Ocaml_operators.html">
        <code class="code">
          <span class="constructor">Ocaml_operators</span>
        </code>
      </a> for more information.
    </div>
  </div>
</div>

```

```css
/* excerpted from styles.css */ 
.api p code, .api li code {
    background-color: #ebf2f9;
}

```

---

<div class="post-metadata">

**Author:** ![octachron](https://avatars.discourse-cdn.com/v4/letter/o/49beb7/32.png) [@octachron](https://discuss.ocaml.org/u/octachron)\
**Post date:** [June 30, 2022, 2:50pm UTC](https://discuss.ocaml.org/t/ocaml-operators-in-different-styles/10096/2 "2022-06-30T14:50:51Z")

</div>

I don’t think that the difference is here on purpose. At least, I missed that difference when reviewing the last manual style update. And since the manual is due for another graphical chart update to better fit the new [ocaml.org](http://ocaml.org), I am not sure if I will have the time to fix the issue.

---

<div class="post-metadata">

**Author:** ![muzimuzhi](https://sea2.discourse-cdn.com/flex020/user_avatar/discuss.ocaml.org/muzimuzhi/32/4185_2.png) [@muzimuzhi](https://discuss.ocaml.org/u/muzimuzhi)\
**Post date:** [July 1, 2022, 12:47am UTC](https://discuss.ocaml.org/t/ocaml-operators-in-different-styles/10096/3 "2022-07-01T00:47:15Z")

</div>

It seems the difference came from `ocamldoc` directly, and it’s the latest manual style that makes the difference more observable.

I’m new to OCaml and below is just my “random” attempt:

Prepare a file `mystdlib.mli`

```ocaml
external ( && ) : bool -> bool -> bool = "%sequand"
(** The boolean 'and'. Evaluation is sequential, left-to-right:
   in [e1 && e2], [e1] is evaluated first, and if it returns [false],
   [e2] is not evaluated at all.
   Right-associative operator, see {!Ocaml_operators} for more information.
*)

external ( & ) : bool -> bool -> bool = "%sequand"
  [@@ocaml.deprecated "Use (&&) instead."]
(** @deprecated {!Stdlib.( && )} should be used instead.
    Right-associative operator, see {!Ocaml_operators} for more information.
*)

```

Then run `ocamldoc -html mystdlib.mli`. [1] In the output file `Mystdlib.html`, I find the problem reproduces:

- doc entry for `( && )` is wrapped in `<p>` tag, while
- doc entry for deprecated `( & )` is not wrapped in `<p>` tag.

GitHub’s “View git blame” utility shows the `<p>` tag is added by PR [MPR#7352,7353: ocamldoc, better paragraphs in html · ocaml/ocaml@d069dbe · GitHub](https://github.com/ocaml/ocaml/commit/d069dbe5857f4dad2db3100aa64b918e6a7c3a61).

[1] I’m following the cs3110 book, which uses `ocaml-base-compiler.4.12.0` ([Installing OCaml — OCaml Programming: Correct + Efficient + Beautiful](https://cs3110.github.io/textbook/chapters/preface/install.html#create-an-opam-switch)). Hence my `ocamldoc --version` gives 4.12.0.
