Skip to content

Conversation

Efnilite
Copy link
Member

@Efnilite Efnilite commented Sep 17, 2025

Problem

Currently documentation is hard to index as all syntax elements are usually in a giant list with no possibility of organizing by type.

Solution

Allows syntax to be organized in docs.json by a few common categories. Here are some examples.

  • The damage source module can use the damage source category,
  • The breeding module can use the entities category,
  • The vector module can use the math category.

These categories can be expanded on by (official) addons, in case a docs site needs them. Extending is as easy as implementing Category and adding your own fields using Category#of.

To allow getting the module with which a syntax was registered, a new method was added to AddonModule for mass registering syntax using the current module. This method is recommended instead of registering to a registry directly. The damage source module has been converted to the new registration API to showcase this.

Testing Completed

Manual testing.

Supporting Information

Adds a new field to the docs.json spec called category.


Completes: none
Related: none

@skriptlang-automation skriptlang-automation bot added the needs reviews A PR that needs additional reviews label Sep 17, 2025
@Efnilite Efnilite changed the title Feature/grouped docs Docs categories Sep 17, 2025
Copy link
Member

@sovdeeth sovdeeth left a comment

Choose a reason for hiding this comment

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

A syntax should be able to belong to multiple categories

@sovdeeth
Copy link
Member

I might also like to see a tree structure for categories:

Math:
  ExprArith
  Vectors:
    ExprVectorLength

@skriptlang-automation skriptlang-automation bot removed the needs reviews A PR that needs additional reviews label Sep 18, 2025
@sovdeeth sovdeeth added the feature Pull request adding a new feature. label Sep 18, 2025
Copy link
Member

@APickledWalrus APickledWalrus left a comment

Choose a reason for hiding this comment

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

From a quick look 🙂

@Efnilite Efnilite requested a review from sovdeeth September 20, 2025 14:17
@SkriptLang SkriptLang deleted a comment from sovdeeth Sep 21, 2025
@Efnilite Efnilite requested a review from sovdeeth September 21, 2025 13:37
Comment on lines +528 to +534
for (String keyword : impl.keywords()) {
if (lower.contains(keyword)) {
options.add(getCategoryJson(category));
break;
}
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Was randomly going through the wip updated docs page again and noticed "category" checked it out saw that timespan and beacon effect are classified as apart of the "Display" category.

I decided to go check into this, this is caused by the usage guessing assignments with contains beacon effect contains display and timespan contains displayed.

Is this behavior planned to stay or do you plan to eventually move away from automatic assignments.
imo if something like this is to stay it should be checked against something more reliable

  • Modules, which is already done with Categorizable
  • Syntax patterns and not descriptions/names %display% vs. display
image

Copy link
Member

@sovdeeth sovdeeth Sep 29, 2025

Choose a reason for hiding this comment

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

I think excluding the description/examples, searching with \b word boundaries, and specifically looking for types in the syntax patterns would be good improvements.
On the docs side, I'd like to see these as selectable categories (think shopping websites) rather than exclusive lists of syntaxes. One syntax may naturally belong to multiple categories, and having a way to select various categories for display I think would improve the UI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature Pull request adding a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants