Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTML structure broken on master #631

Closed
dbuenzli opened this issue Mar 10, 2021 · 6 comments
Closed

HTML structure broken on master #631

dbuenzli opened this issue Mar 10, 2021 · 6 comments

Comments

@dbuenzli
Copy link
Contributor

dbuenzli commented Mar 10, 2021

It seems the merge of PR #627 broke the HTML structure. See the comment here.

@dbuenzli
Copy link
Contributor Author

dbuenzli commented Mar 10, 2021

Just to make things clear the HTML structure of a module is as follows:

body.odoc 
  nav.odoc-nav          (* global nav *) 
  header.odoc-preamble  (* module or .mld preamble *)
  nav.odoc-toc          (* page nav *)
  div.odoc-content      (* module or .mld contents *)

The docs of a module should be allocated to these elements as follows:

  • Docs before the first structure item or heading (of any level) should go in header.odoc-preamble, all remaining docs should go in div.odoc-content.
  • Besides, since that does not seem to be well understood. The first paragraph of header.odoc-preamble (if any) is also what defines the module synopsis.

@Julow
Copy link
Collaborator

Julow commented Mar 11, 2021

If I understand correctly, this issue is related to #235 and both can be solved in the same way.
Since #627, the top-comment of a signature is composed of the comment attached to its definition and the top-comment from its expansion, see #478 (comment).
That didn't break the HTML structure but that exacerbated the first issue. Before, most comments were not in the preamble, only the comment attached to the definition was.

These issues can be fixed by splitting the "composite top-comment" at the first heading, the first part goes into the preamble and the rest, starting from the first heading, in the content and is available in the TOC.
You also proposed a fix for this here #235 (comment), which goes further and consider every comments before the first item to be part of the "composite top-comment".

Besides, since that does not seem to be well understood

Odoc didn't have any code for handling synopsis 16 days ago, #597.
That's not how ocamldoc does it, it takes the first sentence of whatever is the first element. (paragraph, heading and even verbatim blocks)

@dbuenzli
Copy link
Contributor Author

dbuenzli commented Mar 11, 2021

These issues can be fixed by splitting the "composite top-comment" at the first heading, the first part goes into the preamble and the rest, starting from the first heading, in the content and is available in the TOC.

Yes, but it's stop at first heading or structure item (ocaml specification).

You also proposed a fix for this here #235 (comment), which goes further and consider every comments before the first item to be part of the "composite top-comment".

Yes that's the same as what I suggested above. As mentioned there talking in terms of comments as unit doesn't really make sense, you want to talk in terms of blocks of the ocamldoc language.

That's not how ocamldoc does it, it takes the first sentence of whatever is the first element. (paragraph, heading and even verbatim blocks)

My bad, apparently it does, but as seen in #628 in a confusing way. We suggested to change that a long time ago and nowadays it seems everyone agrees, see the discussion and further references in #597.

@dbuenzli
Copy link
Contributor Author

Odoc didn't have any code for handling synopsis 16 days ago, #597.

Btw. that's not entirely true. It didn't have synopses for the !module directive but odoc had synopses for module definitions from a very long time. See e.g. here for rendering example with an older odoc.

Just to make sure: does that mean that we have two different code paths for that ?

@Julow
Copy link
Collaborator

Julow commented Mar 11, 2021

Odoc don't do synopsis (#632).
Uucp has comments attached to its definitions: https://github.com/dbuenzli/uucp/blob/master/src/uucp.mli#L36

@dbuenzli
Copy link
Contributor Author

This has been fixed by #640.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants