Skip to content

Add hidden attribute - #950

Closed
ghost wants to merge 8 commits into
masterfrom
unknown repository
Closed

ghost wants to merge 8 commits into
masterfrom
unknown repository

Conversation

@ghost

@ghost ghost commented Apr 3, 2023 •

Copy link
Copy Markdown

Implemented as specified in #578
I should probably add some documentation (and maybe more tests), but it would be better if someone could confirm that this implementation is correct beforehand.

@ghost ghost mentioned this pull request Apr 5, 2023
@ghost
ghost marked this pull request as ready for review April 6, 2023 07:39
@ghost ghost changed the title WIP: Add hidden attribute Add hidden attribute Apr 6, 2023

@Julow Julow left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The implementation looks good and the tests seem sufficient.

The [@@@hidden] seems unnecessary as we already have (**/**), which can always be used instead.
If we keep this feature, I suggest making "on" and "off" markers more explicit as there's room on the syntax:

[@@@hidden]

type a (* this is hidden *)

[@@@hidden]

type b (* this is visible *)

[@@@hidden on]

type a

[@@@hidden off]

type b

As @lpw25 said in #578 (comment), why use an attribute ([@@hidden]) instead of a tag ((** @hidden *)) ?
Odoc has other similar tags (the current bad name is "internal") like @canonical, @inline, etc...
Pinging @jonludlam as you decided on the syntax.

@Julow

Julow commented Apr 7, 2023

Copy link
Copy Markdown
Collaborator

Thanks a lot for contributing to Odoc :)

@ghost

ghost commented Apr 14, 2023

Copy link
Copy Markdown
Author

@Julow , if we want to use (**@hidden*) tag, then the change will involve odoc-parser. I can do a PR to parser which handles it. Do you think I can proceed, or should we wait for @jonludlam ?

@Julow

Julow commented Apr 14, 2023

Copy link
Copy Markdown
Collaborator

I don't know why we want the attribute but we also want the tag!

There's work to do on odoc-parser indeed. On Odoc's side, this kind of attributes are handled specifically here: https://github.com/ocaml/odoc/blob/master/src/model/semantics.mli#L14 the type handle_internal_tags signals what attributes are expected but @hidden is always expected so you don't need to hook into that and instead change the return value of the parsing functions.

@ghost ghost mentioned this pull request Apr 14, 2023
@ghost

ghost commented Apr 14, 2023

Copy link
Copy Markdown
Author

I have created a PR for a new tag: ocaml-doc/odoc-parser#16

@panglesd panglesd mentioned this pull request Apr 20, 2023
Comment thread src/loader/doc_attr.ml
match load_payload attr_payload with
| Some p -> Some (`Doc p)
| None -> None)
| "hidden" | "ocaml.hidden" -> Some (`Hidden attr_loc)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We discussed with @jonludlam and found that we don't need the attribute but prefer the tag instead. Do you mind opening a PR for that ?

@ghost ghost closed this Oct 14, 2025
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants