Bug: Spaces added to preformatted code style docstring elements
Describe the bug Formatting code such as:
type sp =
| Cut (** {[@,]} *)
adds spaces within the preformatted code element, producing
type sp =
| Cut (** {[ @, ]} *)
How to Reproduce
Change the Cut docstring in Fmt.mli as above and make test.
That's the formatting we expect, to separate the heavier syntax {[ from the bigger piece of code. Perhaps the source can be changed to use [ ... ] instead, which is expected to contain a small bit of code and isn't formatted by ocamlformat.
Note that this code block will appear heavy in Odoc's output.
I don't know what would look better in odoc's output, I'm neutral regarding using wrap "[@;<1 2>" "@ ]" or wrap "[@;<0 2>" "@,]", but I admit having spaces added can be surprising
Maybe it is just me, but my interpretation of "preformatted" in the spec makes me think that adding spaces is quite surprising.
Odoc doesn't follow ocamldoc in a lot of cases. Odoc is not sensitive to whitespaces around {[ and ]} and to the indentation of the whole block. It's reasonable to add spaces and newlines here and to indent the whole block. (we do all this)