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

Library documentation through aiken docs #185

Merged
merged 18 commits into from
Dec 17, 2022
Merged

Library documentation through aiken docs #185

merged 18 commits into from
Dec 17, 2022

Conversation

KtorZ
Copy link
Member

@KtorZ KtorZ commented Dec 16, 2022

  • 📍 Define 'is_library' for 'CheckedModule'
    So that we can separate libraries from executable modules if necessary.

  • 📍 Introduce 'docs' for generating documentation for aiken libraries.

  • 📍 Add a 'docs' method to projects, using the newly introduced docs::generate_all

  • 📍 Add command 'docs' for generating project documentation.

  • 📍 Support data-types in documentation.

  • 📍 Fix type-parameter pretty printing (use chevrons)

  • 📍 Refactor project source parsing
    There was already a 'parse_sources' function, and 'parse' was actually more about typechecking than parsing.

  • 📍 Implement modules' extra, to get function & module comments in docs.

  • 📍 Apply suggestions from clippy.

  • 📍 Support module constants in docs.

  • 📍 Define HighlightJS definition for Aiken.

  • 📍 Do not show link to source.
    This require slightly more work and has little benefits at this stage given that the sources are literally inlined in the docs.

  • 📍 Factor out common module prefix when all modules are under a same namespace.

  • 📍 Adjust docs theme to catppuccin

    • light-mode uses catpuccin-latte
    • dark-mode uses catpuccin-mocha
  • 📍 Add source repository to config & docs.

Screenshot 2022-12-17 at 03 21 43

Screenshot 2022-12-17 at 03 22 43

Screenshot 2022-12-17 at 03 22 18

Screenshot 2022-12-17 at 03 22 05

@KtorZ KtorZ requested a review from rvcas December 16, 2022 18:54
@KtorZ KtorZ self-assigned this Dec 16, 2022
@rvcas rvcas added need for documentation Improvements or additions to documentation aiken lang labels Dec 16, 2022
@KtorZ
Copy link
Member Author

KtorZ commented Dec 17, 2022

See preview: https://aiken-lang.github.io/stdlib/

  - light-mode uses catpuccin-latte
  - dark-mode uses catpuccin-mocha
impl CheckedModule {
pub fn is_library(&self) -> bool {
self.ast.definitions().any(|def| match def {
Definition::Fn(func_def) => VALIDATOR_NAMES.contains(&func_def.name.as_str()),
Copy link
Member

Choose a reason for hiding this comment

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

this check is confusing me a little. Can't we instead just check self.kind?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's actually unused. I figured in the end that we could also just generate docs for validators if they are any 🤷‍♀️

So this could/should be removed

  Redundant with the `kind: ModuleKind` field already.
  - [x] Display function arguments using a newline-multiline strategy
    when the signature gets too long. For example:

    ```
    union_with
      ( left left: AssocList<key, value>
      , right right: AssocList<key, value>
      , with with: fn(key, value, value) -> value
      ) -> AssocList<key, value>
    ```

  - [x] Show type-aliases as type-aliases in signatures; provided
    they've been specified as type annotations. Otherwise, fallback to
    the inferred type.

  - [x] Do not show argument names in signatures, but show labels when
    they're present. This reflects more the original intent behind
    labels (which are meant as public-facing documentation).
@KtorZ KtorZ merged commit 53eab4b into main Dec 17, 2022
@KtorZ KtorZ deleted the aiken-docs branch December 17, 2022 12:14
@KtorZ KtorZ changed the title Aiken docs Library documentation through aiken docs Dec 20, 2022
@KtorZ KtorZ mentioned this pull request Dec 20, 2022
45 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need for documentation Improvements or additions to documentation
Projects
Status: 🚀 Released
Development

Successfully merging this pull request may close these issues.

None yet

2 participants