Skip to content

Initial and trailing whitespace on code fences and verbatim #39

@dbuenzli

Description

@dbuenzli

This is certainly due to an underspecification of the ocamldoc language. As you can see here:

http://docs.mirage.io/cmdliner/Cmdliner/index.html#basics
http://erratique.ch/software/cmdliner/doc/Cmdliner#basics

The first code fence has no initial white line, but the second has. This is the result of writing the first one as:

{[mycode]}

and the second one as:

{[
mycode]}

or

{[
mycode
]}

The last two forms are essential for code fences and verbatims that span more than one-line otherwise you cannot write your code sample properly aligned and indented in your sources which makes the source less readable:

{[let x = 3
let y = 4]}

you really want to write:

{[
let x = 3
let y = 3
]}

I'm not sure which rules ocamldoc follows exactly but my gut feeling is that you should simply ignore a newline just after {[ and {v and just before ]} and v}.

(This is not visible for trailing newlines in the html because at that point you end up a block-level element anyways).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions