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

Documentation Generator #339

Closed
3 tasks done
turbolent opened this issue Aug 21, 2020 · 1 comment
Closed
3 tasks done

Documentation Generator #339

turbolent opened this issue Aug 21, 2020 · 1 comment

Comments

@turbolent
Copy link
Member

turbolent commented Aug 21, 2020

Issue To Be Solved

It would be nice to have a tool that generates human-readable documentation for Cadence programs.

Suggest A Solution

Most pieces to build such a tool are in place:

  • The AST is well-defined and can be serialized to a well-defined JSON format if needed (i.e. the tool could be potentially written in a language other than Go)
  • The parser parses documentation comments ("docstrings"; line comments starting with /// and block comments starting with /**) for all declarations

The tool's main task would be to traverse the AST and generate e.g. Markdown, HTML, etc.

To generate the output, the documentation comments need to be written in a specific format/syntax. AFAIK there is no standard for this across programming languages. I think it would be best to adopt something that exists, I don't think it's necessary to reinvent the wheel here.

Inspiration:

  • Swift: Markdown-based, with certain keywords like "Parameters"
  • Solidity's NatSpec: Purely specific keywords/"tags" (@ prefix)
  • Kotlin's KDoc syntax: Mix of Markdown and specific keywords/"tags" (@ prefix)
  • Rust: also uses Markdown, but e.g. does not have a standardized way to refer to parameters
  • Elixir: Markdown-based

Choosing a Markdown-based format has the benefit that it e.g. allows adding sections, example code blocks, etc.

Definition of Done

  • Implement tool
  • Tests
  • Documentation
@SupunS
Copy link
Member

SupunS commented Jul 9, 2021

This is now available through the following PRs:

I'll close this issue since the all tasks mentioned here are covered.

We can open new git-issues for any feature/improvement requests.

@SupunS SupunS closed this as completed Jul 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants