Skip to content

Documentation annotations improvements (Prototype).#7470

Merged
sovdeeth merged 5 commits into
SkriptLang:dev/patchfrom
Moderocky:exemplar
Feb 28, 2025
Merged

Documentation annotations improvements (Prototype).#7470
sovdeeth merged 5 commits into
SkriptLang:dev/patchfrom
Moderocky:exemplar

Conversation

@Moderocky
Copy link
Copy Markdown
Member

SOTU

The examples annotation format currently has three issues:

  1. It doesn't differentiate between two separate examples and one example with multiple lines.
  2. It's a bit annoying to escape characters (quotes, tabs, etc.) and these don't always display as expected in the html.
  3. There are some inconsistencies in their formatting.

For example, around 40% of the multi-line examples are currently indented.
image
The rest are not.
image

I, personally, dislike this practice because it's not really in line with the code style and it's likely to be erased by auto-reformatting. That said, I understand why it's currently done for clarity.

The New Proposal

  1. Each example gets its own annotation.
  2. Each example is contained in one string. Multi-line examples can use Java 17's multi-line strings.
  3. Formatting characters (quotes, whitespace, etc.) do not need to be escaped in this mode.
  4. Possibly, include a flag for whether an example is just lines of code, or of an entire structure at the file root. Docs sites may want to display these differently in some way. (non-essential)

Side-by-Side

The current format:
image

The new (proposed) format:
image

@Moderocky Moderocky added the housekeeping Housekeeping-related issue or task. label Jan 18, 2025
@Efnilite Efnilite added enhancement Feature request, an issue about something that could be improved, or a PR improving something. documentation Related to Skript's official documentation. labels Jan 19, 2025
Comment thread src/main/java/ch/njol/skript/doc/Example.java Outdated
Co-authored-by: Efnilite <35348263+Efnilite@users.noreply.github.com>
@Moderocky Moderocky marked this pull request as ready for review January 23, 2025 11:21
@sovdeeth sovdeeth added the patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version. label Feb 28, 2025
@sovdeeth sovdeeth merged commit 20b8f2a into SkriptLang:dev/patch Feb 28, 2025
erenkarakal pushed a commit to erenkarakal/Skript that referenced this pull request Nov 26, 2025
* Add example annotation.

* Support new annotation in documentation generators.

* Update src/main/java/ch/njol/skript/doc/Example.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Related to Skript's official documentation. enhancement Feature request, an issue about something that could be improved, or a PR improving something. housekeeping Housekeeping-related issue or task. patch-ready A PR/issue that has been approved and is ready to be merged/closed for the next patch version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants