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

Define rules for documentation comments in code #1298

Open
i582 opened this issue Jan 13, 2025 · 2 comments
Open

Define rules for documentation comments in code #1298

i582 opened this issue Jan 13, 2025 · 2 comments
Assignees
Labels
kind: docs Documentation for docs.tact-lang.org kept in docs folder

Comments

@i582
Copy link
Contributor

i582 commented Jan 13, 2025

Right now, in stdlib, we can find different incompatible documentation styles (for example, using two slashes or three slashes).

We need to define a set of rules as a separate document in the documentation, which will describe the main rules for how documentation in the code is formatted.

In PR (or RFC document), each rule should have a description of the reason why it is done this way (for example, why references to other symbols should be wrapped with [``], the answer: for clarity and easier implementation in tooling).

@i582 i582 added language design kind: docs Documentation for docs.tact-lang.org kept in docs folder labels Jan 13, 2025
@i582 i582 self-assigned this Jan 13, 2025
@anton-trunov
Copy link
Member

See #1297

@novusnota
Copy link
Member

novusnota commented Jan 13, 2025

My 2 cents :)

The current overarching idea of the doc comments is that they simply represent the actual docs displayed on https://docs.tact-lang.org. And that they don't need a JSDoc parser — they are just simple markdown, so could be parsed with markdown parser. This makes the public documentation the source of truth, and makes doc comments more humane.

In particular:

  1. This partially solves the 'Available since ...' and any other possibly error-prone things as you've pointed out, since everything is copied from the docs"
  2. The reference docs have a rather strict structure and a simple way to convert the doc text to the doc comment.

Regarding the second point:

  1. First, the heading #... becomes a text description depending on the object. If that's a function we're documenting, then it becomes a way to describe how that function is called / a bit about its semantics: "Global function", "Extension [mutation] function", "Storage function" — global called as is, now(); extension is called as a method on the value of the target self type, like: .storeInt(); and finally, storage is called like self.functionOfThisContract().
  2. Then goes the Badge, converted to the textual description: "Available since Tact 1.5", for example.
  3. Then goes the rest, although with removing the doc pages-specific "noise", such as markdown links.
  4. Finally, the "See:" part, that links to the corresponding item in the docs and, if present, also adds links from the "Useful links" aside.

This approach and style was somewhat outlined in the description to this commit: 8237edb

Of course, everything above applies to the revised, /// comments, and doesn't yet apply to the comments that wasn't updated yet and for that reason stay with previous // comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: docs Documentation for docs.tact-lang.org kept in docs folder
Projects
None yet
Development

No branches or pull requests

4 participants