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

PR#7363: documentation, start heading levels at 1 #830

Merged
merged 5 commits into from
Oct 5, 2017

Conversation

Octachron
Copy link
Member

On a suggestion of @dbuenzli, this pull request proposes to start the heading level of all documentation comments at level {1 rather than {6 in the standard library or {2 as the originally intended starting level of normal headings for ocamldoc documentation comments, .

The second commit in this PR corresponds to the straightforward change of heading levels in the documentation.

The first commit is more subtle and alters the semantic of heading levels in ocamldoc to make the heading level {1 available for standard use. Originally, the heading level {1 was implicitly used by ocamldoc for the global module title. Consequently, subheaders needed to start at level {2, forgoing the level {1 in most documentations (since it is quite infrequent to have multiple main titles in the same module).

This first commit acknowledges the natural desire to start counting at{1 and therefore moves up the main module title to an implicit level {0 . It becomes therefore possible to use level {1 for ordinary subheading, whereas the rare cases of multiple main title would have to settle for a more disquieting level {0.

All ocamldoc backend have been update accordingly. In particular, after this patch, the html backend associates a header level <h(n+1)> to the ocamldoc level {n.

To preserve backward compatibility, the default ocamldoc settings preserves the
appearance (for the html backend) or the structure (for the latex and texinfo backends) of the generated files. In particular levels {1 and {0 are rendered in the same way in all backends. Consequently, no documentation using this default setting should be impacted by the hierarchy level change. Similarly, for the reference manual, the combined changes in the first and second commits cancel each other and the generated documentation files are unchanged.

Contrarily, documentations using custom styles would probably have to update their styles.

Finally, the texinfo backend lacked the possibility to customize the mapping between ocamldoc heading levels and the texinfo headings levels. The third commit in this PR adds thus a texinfotitle option that mirrors the latextitle latex option. In particular, it becomes possible to decouple the rendering of level {0 and {1 (which are coupled in the default mapping for compatibility reason).
With this last change, level {1 headings can be used coherently across all ocamdldoc backends.

@@ -135,7 +135,7 @@ module Name :
(** Representation and manipulation of method / function / class / module parameters.*)
module Parameter :
sig
(** {3 Types} *)
(** {2 Types} *)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why aren't you using 1 here ? The idea is that ocamldoc headers section ocaml modules, so you should restart at 1 here, regardless of whether this is a submodule or not.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Ok I guess this 3->2 is an automated translation)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The translation was indeed automated, and you are right I missed the fact that these headers were submodule headers and should retstart at 1. Fixed, thanks.

@Octachron
Copy link
Member Author

I forgot to mention in the description above that this PR also updates the compiler and related tools documentation to start headers at {1, for the sake of consistency.

@Octachron
Copy link
Member Author

Thinking about this PR, it might also be a good occasion to add a new (secondary) default style
that would exploit the newly available {1 heading.

@dbuenzli , any opinion on this subject?

@dbuenzli
Copy link
Contributor

dbuenzli commented Feb 2, 2017

@dbuenzli , any opinion on this subject?

Not really I have been living on alternate stylesheets for ages now. But I think it would be better
to tweak the current one so that both the old scheme and the new scheme look the same (other projects e.g. batteries IIRC still start at 6).

For example that's what I'm doing in odig, I restart 6 as if it is 1, see this comment.

@damiendoligez damiendoligez added this to the 4.06.0 milestone Sep 29, 2017
This commit makes the heading hierarchy of ocamldoc start at {0 rather
than {1. This level {0 should be reserved for global titles, freeing
the use of {1 for normal subtitles.
@Octachron Octachron force-pushed the stdlib_doc_unnested_hierarchy branch from e7728b1 to 5b55f55 Compare October 4, 2017 10:08
@Octachron
Copy link
Member Author

I have rebased the PR, since it is considered for 4.06.0 integration. One argument in favor for such integration is that it would bundle ocamldoc changes that can break custom ocamldoc style in one version.

@gasche
Copy link
Member

gasche commented Oct 4, 2017

Note: my understanding of the 4.06.0 milestone is not "we think this should go into 4.06.0" but "we need to make a decision on this PR (possibly to delay) before 4.06 is released".

@gasche
Copy link
Member

gasche commented Oct 4, 2017

I would agree with merging this in 4.06; ocamldoc is lower-risk than other parts of the distribution, and the fact that both you and @dbuenzli like the change means it's probably a good idea.

Could you update the Changes item with a link to this GPR? It is important as it links users to the details of your implementation and its backward-compatibility properties.

There were more ocamldoc-releated potentially-breaking changes than usually in this release cycle. Would you mind writing a small document that lists them, gives a short rationale, and explains the backward-compatibility story? I just looked at the change entries, for some of them it's relatively clear, for the others it's not (for example the Changes entry of the current PR does not explain much about backward-compatibility). I'm thinking of creating another "Detailed changes" for 4.06, I could populate these entries with your content, or link to a specialized document with all advice in one place.

@Octachron Octachron force-pushed the stdlib_doc_unnested_hierarchy branch from 5b55f55 to 7726d9f Compare October 4, 2017 10:32
@Octachron
Copy link
Member Author

I have updated the Changes entry to mention both this PR number and that custom css style will probably be broken.

In any case, I agree that writing a small synthetic document for the ocamldoc changes in 4.06 and circulating it is good idea. I will take care of that.

Copy link
Member

@gasche gasche left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I or someone else can merge (and cherry-pick to 4.06) if the CI is green.

(No need to squash, the commits are cleanly separated.)

@Octachron Octachron force-pushed the stdlib_doc_unnested_hierarchy branch from 7726d9f to 8609d04 Compare October 4, 2017 11:05
@Octachron Octachron merged commit db03ced into ocaml:trunk Oct 5, 2017
@Octachron
Copy link
Member Author

Merged. For the cherry-pick on 4.06, if I am not mistaken, the process is to squash the commit ranges in a single commit?

@gasche
Copy link
Member

gasche commented Oct 5, 2017

If you like to keep commit separates, you can cherry-pick each of them. Usually people just cherry-pick the github merge commit, which has the effect of implicit squashing.

@Octachron
Copy link
Member Author

Cherry-picked the whole commit range to 4.06: 8ca16f7^..b61e6e8

ctk21 pushed a commit to ocaml-multicore/ocaml that referenced this pull request Jan 7, 2022
remove Int/Long/Bool_field macros
sadiqj pushed a commit to sadiqj/ocaml that referenced this pull request Jan 7, 2022
remove Int/Long/Bool_field macros
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Sep 21, 2022
* Apply the fix from ocaml#829 to asmcomp

* Turn warnings on in comballoc and make match exhaustive
sadiqj pushed a commit to sadiqj/ocaml that referenced this pull request Feb 21, 2023
…#830)

* Apply the fix from ocaml#829 to asmcomp

* Turn warnings on in comballoc and make match exhaustive
stedolan pushed a commit to stedolan/ocaml that referenced this pull request Mar 21, 2023
25188da flambda-backend: Missed comment from PR802 (ocaml#887)
9469765 flambda-backend: Improve the semantics of asynchronous exceptions (new simpler version) (ocaml#802)
d9e4dd0 flambda-backend: Fix `make runtest` on NixOS (ocaml#874)
4bbde7a flambda-backend: Simpler symbols (ocaml#753)
ef37262 flambda-backend: Add opaqueness to Obj.magic under Flambda 2 (ocaml#862)
a9616e9 flambda-backend: Add build system hooks for ocaml-jst (ocaml#869)
045ef67 flambda-backend: Allow the compiler to build with stock Dune (ocaml#868)
3cac5be flambda-backend: Simplify Makefile logic for natdynlinkops (ocaml#866)
c5b12bf flambda-backend: Remove unnecessary install lines (ocaml#860)
ff12bbe flambda-backend: Fix unused variable warning in st_stubs.c (ocaml#861)
c84976c flambda-backend: Static check for noalloc: attributes (ocaml#825)
ca56052 flambda-backend: Build system refactoring for ocaml-jst (ocaml#857)
39eb7f9 flambda-backend: Remove integer comparison involving nonconstant polymorphic variants (ocaml#854)
c102688 flambda-backend: Fix soundness bug by using currying information from typing (ocaml#850)
6a96b61 flambda-backend: Add a primitive to enable/disable the tick thread (ocaml#852)
f64370b flambda-backend: Make Obj.dup use a new primitive, %obj_dup (ocaml#843)
9b78eb2 flambda-backend: Add test for ocaml#820 (include functor soundness bug) (ocaml#841)
8f24346 flambda-backend: Add `-dtimings-precision` flag (ocaml#833)
65c2f22 flambda-backend: Add test for ocaml#829 (ocaml#831)
7b27a49 flambda-backend: Follow-up PR#829 (comballoc fixes for locals) (ocaml#830)
ad7ec10 flambda-backend: Use a custom condition variable implementation (ocaml#787)
3ee650c flambda-backend: Fix soundness bug in include functor (ocaml#820)
2f57378 flambda-backend: Static check noalloc (ocaml#778)
aaad625 flambda-backend: Emit begin/end region only when stack allocation is enabled (ocaml#812)
17c7173 flambda-backend: Fix .cmt for included signatures (ocaml#803)
e119669 flambda-backend: Increase delays in tests/lib-threads/beat.ml (ocaml#800)
ccc356d flambda-backend: Prevent dynamic loading of the same .cmxs twice in private mode, etc. (ocaml#784)
14eb572 flambda-backend: Make local extension point equivalent to local_ expression (ocaml#790)
487d11b flambda-backend: Fix tast_iterator and tast_mapper for include functor. (ocaml#795)
a50a818 flambda-backend: Reduce closure allocation in List (ocaml#792)
96c9c60 flambda-backend: Merge ocaml-jst
a775b88 flambda-backend: Fix ocaml/otherlibs/unix 32-bit build (ocaml#767)
f7c2679 flambda-backend: Create object files internally to avoid invoking GAS (ocaml#757)
c7a46bb flambda-backend: Bugfix for Cmmgen.expr_size with locals (ocaml#756)
b337cb6 flambda-backend: Fix build_upstream for PR749 (ocaml#750)
8e7e81c flambda-backend: Differentiate is_int primitive between generic and variant-only versions (ocaml#749)

git-subtree-dir: ocaml
git-subtree-split: 25188da
EmileTrotignon pushed a commit to EmileTrotignon/ocaml that referenced this pull request Jan 12, 2024
* make package documentation link more obvious (ocaml#828)

* make documentation link more obvious

* minor style improvement

Co-Authored-By: Sabine Schmaltz <sabine@tarides.com>

* improve authors/maintainers display on package overview (ocaml#1001)

* refactor package urls, routes, and handlers (ocaml#999)

* refactor package urls, routes, and handlers
* move package redirects to redirection.ml

* Unify package overview and documentation layout (ocaml#1015)

* unified package overview/docs layout

Rearranges package overview and documentation such that:

* package_layout.eml defines the two sidebars and the
  content area
* there is a navigation element to switch between
  Overview (About) and Documentation (Docs)
* there is a placeholder element for the upcoming
  in-package search (to remind us how important
  this feature is and to show users that
  we have a plan where it goes)

Consequences:

* package overview page now has a collapsing sidebar
  with a button to slide it in on small screens
* package documentation now has a tablet (md) layout
  that shows the sidebar on-screen, instead of collapsed

* add text-sm which was lost during unification

* "Overview" instead of "About" since we have the space

* Add support for sitemap.xml

* Generate sitemap.xml by dream

* Apply suggestions from @cuihtlauac code review

Co-authored-by: Cuihtlauac Alvarado <cuihtlauac@users.noreply.github.com>

* Convert lists of urls to sequences and change names of functions

* Apply suggestions from @cuihtlauac code review 2

Co-authored-by: Cuihtlauac Alvarado <cuihtlauac@users.noreply.github.com>

* Delete subdomains URLs and URLs returning status code other than 200

* Apply suggestions from @cuihtlauac code review 3

Co-authored-by: Cuihtlauac Alvarado <cuihtlauac@users.noreply.github.com>

* Update PR

* formating

* do not touch playground asset

* Apply suggestions from @cuihtlauac code review 4

* Apply suggestions from @cuihtlauac code review 5

* Apply suggestions from @cuihtlauac code review 6

* Apply suggestions from @cuihtlauac code review 7

* Apply suggestions from @cuihtlauac code review 8

---------

Co-authored-by: Sabine Schmaltz <sabine@tarides.com>
Co-authored-by: sabine <sabine@users.noreply.github.com>
Co-authored-by: Cuihtlauac Alvarado <cuihtlauac@users.noreply.github.com>
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

Successfully merging this pull request may close these issues.

None yet

4 participants