### Start Local Development Server Source: https://github.com/evaera/moonwave/blob/master/website/README.md Starts a local development server for live preview. Changes are reflected without server restart. ```bash yarn start ``` -------------------------------- ### Custom Sidebar Configuration for Moonwave Source: https://context7.com/evaera/moonwave/llms.txt Configure custom documentation sidebars in .moonwave/sidebars.js. This example defines a 'Getting Started' doc and a 'Guides' category. ```javascript // .moonwave/sidebars.js module.exports = { mySidebar: [ { type: "doc", id: "intro", label: "Getting Started" }, { type: "category", label: "Guides", items: ["guides/installation", "guides/configuration"], }, ], } ``` -------------------------------- ### Install Dependencies with Yarn Source: https://github.com/evaera/moonwave/blob/master/website/README.md Installs project dependencies using Yarn. Run this command after cloning the repository. ```bash yarn ``` -------------------------------- ### Start Moonwave Development Server Source: https://context7.com/evaera/moonwave/llms.txt Starts a local development server with live-reloading. By default, it looks for Lua source in `src/` or `lib/`. Use `--code` to specify alternate paths. ```bash moonwave dev ``` ```bash moonwave dev --code MyModule ``` ```bash moonwave dev --code packages/core --code packages/utils ``` ```bash moonwave dev --fresh ``` ```bash moonwave dev --install ``` -------------------------------- ### Run Moonwave Development Server Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md Start the Moonwave development server to automatically generate and preview your documentation website. This command should be run from your project's root directory. ```bash moonwave dev ``` -------------------------------- ### Install Moonwave Globally Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md Install the latest version of Moonwave globally using npm. This command makes the `moonwave` executable available in your terminal. ```bash npm i -g moonwave ``` -------------------------------- ### GitHub Actions Workflow for Publishing Docs Source: https://context7.com/evaera/moonwave/llms.txt Automate documentation deployment to GitHub Pages on every push to the 'main' branch. This workflow checks out code, sets up Node.js, installs Moonwave, and builds/publishes the documentation. ```yaml # .github/workflows/publish-docs.yml name: publish-docs on: push: branches: ["main"] jobs: publish: runs-on: ubuntu-latest name: Publish docs to GitHub Pages steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "22" - run: npm i -g moonwave@latest - name: Publish run: | git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git git config --global user.email "support+actions@github.com" git config --global user.name "github-actions-bot" moonwave build --publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -------------------------------- ### Docusaurus Plugin Configuration for Moonwave Source: https://context7.com/evaera/moonwave/llms.txt Integrate Moonwave directly into a Docusaurus configuration for advanced setups. This example shows how to specify source directories, source URLs, class order, API categories, and auto-section paths. ```javascript // docusaurus.config.js module.exports = { plugins: [ [ "docusaurus-plugin-moonwave", { code: ["src", "lib"], // Paths to Lua source directories sourceUrl: "https://github.com/myorg/myrepo/blob/main/", classOrder: ["MyService", "DataManager"], apiCategories: ["constructor", "events"], autoSectionPath: "packages", // Auto-section by subfolder name }, ], ], } ``` -------------------------------- ### GitHub Actions Workflow for Publishing Source: https://github.com/evaera/moonwave/blob/master/website/docs/Publishing.md This YAML workflow automates the building and publishing of your Moonwave documentation website to GitHub Pages on every push to the master branch. It checks out the code, sets up Node.js, installs Moonwave, and runs the build --publish command. ```yaml # .github/workflows/publish-docs.yml name: publish-docs on: push: branches: ["master"] jobs: status: runs-on: ubuntu-latest name: Publish docs to GitHub Pages steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 with: node-version: "22" - run: npm i -g moonwave@latest - name: Publish run: | git remote set-url origin https://git:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git git config --global user.email "support+actions@github.com" git config --global user.name "github-actions-bot" moonwave build --publish env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} ``` -------------------------------- ### Documenting a Class with @class Source: https://context7.com/evaera/moonwave/llms.txt Declare a class with `@class ` in a doc comment placed above the class definition. Each class gets its own API page. ```lua --[=[@class MyService MyService handles all game state transitions and exposes methods for querying and mutating that state. ]=] local MyService = {} MyService.__index = MyService ``` ```lua -- Triple-dash style is equivalent: --- @class AnotherClass --- A simple utility class. local AnotherClass = {} ``` -------------------------------- ### Custom CSS for Moonwave Source: https://context7.com/evaera/moonwave/llms.txt Define global CSS overrides in the .moonwave/custom.css file. This example sets primary colors and the base font family. ```css /* .moonwave/custom.css */ :root { --ifm-color-primary: #7c3aed; --ifm-color-primary-dark: #6d28d9; --ifm-font-family-base: "Inter", sans-serif; } ``` -------------------------------- ### Update Moonwave Installation Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md To update your Moonwave installation to the latest version, run the following npm command. This ensures you have the newest features and bug fixes. ```bash npm i -g moonwave@latest ``` -------------------------------- ### Build Static Moonwave Website Source: https://context7.com/evaera/moonwave/llms.txt Compiles the documentation into a static website ready for deployment. Outputs to a `build/` directory by default. ```bash moonwave build ``` ```bash moonwave build --out-dir docs-output ``` ```bash moonwave build --publish ``` -------------------------------- ### Build and Publish Website Source: https://github.com/evaera/moonwave/blob/master/website/docs/Publishing.md Use this command to build your website and publish it directly to GitHub Pages if you are using Git and GitHub Pages. ```bash moonwave build --publish ``` -------------------------------- ### Build Static Website Content Source: https://github.com/evaera/moonwave/blob/master/website/README.md Generates static website files into the 'build' directory, ready for hosting. ```bash yarn build ``` -------------------------------- ### Project Configuration: moonwave.toml Source: https://context7.com/evaera/moonwave/llms.txt Customize project settings like title, URLs, navigation, and Docusaurus options in `moonwave.toml`. ```toml # moonwave.toml title = "MyLibrary" # Auto-detected from Git gitRepoUrl = "https://github.com/myorg/mylibrary" # Auto-detected from Git gitSourceBranch = "main" changelog = true [docusaurus] onBrokenLinks = "throw" url = "https://myorg.github.io" baseUrl = "/mylibrary" tagline = "A powerful Lua library" [footer] style = "dark" copyright = "Copyright © 2024 MyOrg. Built with Moonwave." # Custom navbar links [[navbar.items]] href = "https://discord.gg/myserver" label = "Discord" position = "right" # Order and section grouping for the API sidebar [[classOrder]] section = "Core" classes = ["MyService", "DataManager"] [[classOrder]] section = "Utilities" collapsed = false classes = ["StringUtils", "TableUtils"] # Tag-based TOC categories apiCategories = ["constructor", "events", "utility"] # Auto-section classes by source folder autoSectionPath = "packages" ``` -------------------------------- ### Deploy Website to GitHub Pages Source: https://github.com/evaera/moonwave/blob/master/website/README.md Builds the website and pushes it to the 'gh-pages' branch for GitHub Pages hosting. Ensure to replace '' with your actual username. ```bash GIT_USER= USE_SSH=true yarn deploy ``` -------------------------------- ### Connecting with Configuration Source: https://context7.com/evaera/moonwave/llms.txt Connects using the provided configuration object. ```APIDOC ## `MyService.connect` ### Description Connects using the provided configuration. ### Parameters #### Path Parameters * `config` (Config) - Required - Connection settings. ### Response #### Success Response (200) * `success` (boolean) - True if the connection succeeded. ### Request Example ```lua MyService.connect({ Host = "example.com", Port = 8080, Timeout = 5, Retries = 3 }) ``` ### Response Example ```lua { "success": true } ``` ``` -------------------------------- ### Default moonwave.toml Configuration Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md A sample `moonwave.toml` file showing default properties. Most properties are optional and can be automatically filled from Git. ```toml title = "MyProjectName" # From Git gitRepoUrl = "https://github.com/evaera/moonwave" # From Git gitSourceBranch = "master" changelog = true classOrder = [] [docusaurus] onBrokenLinks = "throw" onBrokenMarkdownLinks = "warn" favicon = "" # From git: organizationName = "AuthorName" projectName = "MyProjectName" url = "https://AuthorName.github.io" baseUrl = "/MyProjectName" tagline = "Your project's tagline" [footer] style = "dark" copyright = "Copyright © 2021 AuthorName. Built with Moonwave and Docusaurus" [[footer.links]] title = "examples" [[footer.links.items]] label = "example" href = "https://example.com/" ``` -------------------------------- ### Custom Home Page Configuration: moonwave.toml Source: https://context7.com/evaera/moonwave/llms.txt Enable a custom home page and control its content, including banner images and feature sections, via `moonwave.toml`. ```toml [home] enabled = true includeReadme = true bannerImage = "https://example.com/banner.png" [[home.features]] title = "Easy Setup" description = "Get docs from comments with zero boilerplate." image = "https://example.com/icon1.png" [[home.features]] title = "Live Reload" description = "Changes appear instantly in your browser." image = "https://example.com/icon2.png" ``` -------------------------------- ### Configure Website URL and Base URL Source: https://github.com/evaera/moonwave/blob/master/website/docs/Publishing.md Set the url and baseUrl in your moonwave.toml file for custom domains or when hosting on the root path of GitHub Pages. Ensure baseUrl is set to "/" for root path hosting. ```toml url = "https://organizationName.github.io" baseUrl = "/projectName" ``` -------------------------------- ### Documenting Function Parameters and Return Values with @param and @return Source: https://context7.com/evaera/moonwave/llms.txt Use `@param` to document function arguments and `@return` for return values. Moonwave auto-detects Luau types when present. Multiple `@return` tags support multiple return values. ```lua --[=[ Searches for items matching a query. @param query string -- The search string. @param maxResults number -- Maximum number of results to return. @param caseSensitive boolean? -- Whether the match is case-sensitive. Defaults to false. @return {string} -- Array of matching item names. @return number -- Total number of matches found (may exceed maxResults). ]=] function MyService:search(query, maxResults, caseSensitive) -- implementation end -- With Luau type annotations — type is auto-detected, only description needed: --[=[ @param name -- The player's display name. @param score -- Their score to record. @return -- Whether the record was saved successfully. ]=] function MyService:recordScore(name: string, score: number): boolean -- implementation end ``` -------------------------------- ### Optional Function Arguments Source: https://github.com/evaera/moonwave/blob/master/website/docs/Types.md Demonstrates equivalent syntaxes for optional function arguments using union types with nil, or a question mark after the argument name or type. Choose the syntax that enhances readability. ```luau (arg: string | nil) -> () ``` ```luau (arg?: string) -> () ``` ```luau (arg: string?) -> () ``` -------------------------------- ### API Class Order - Nested Sections Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Create hierarchical API documentation by defining nested sections within `[[classOrder]]`. Supports classes, tags, and collapse control at any level. ```toml [[classOrder]] section = "Parent Section" # Child section with classes [[classOrder.items]] section = "Child Section 1" classes = ["Class1", "Class2"] # Child section with tagged classes [[classOrder.items]] section = "Child Section 2" tag = "childTag" # Classes directly under Parent Section (no subsection) [[classOrder.items]] classes = ["Class3"] # Deeper nesting with grandchild section [[classOrder.items]] section = "Child Section 3" [[classOrder.items.items]] section = "Grandchild Section" classes = ["Class4", "Class5"] # The original format still works alongside nested sections [[classOrder]] section = "Regular Section" classes = ["Class6", "Class7"] ``` ```toml [[classOrder]] section = "Always Expanded" collapsed = false [[classOrder.items]] section = "Always Collapsed Child" collapsed = true classes = ["Class1"] ``` -------------------------------- ### Enabling a Custom Home Page Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md To use a custom home page instead of the project's README, set `enabled` to `true` in the `[home]` section of your `moonwave.toml`. Optionally include the README and a banner image. ```toml [home] enabled = true includeReadme = true # Optional bannerImage = "https://url" # Optional [[home.features]] title = "Feature 1" description = "This is a feature" image = "https://url" [[home.features]] title = "Feature 2" description = "This is a second feature" image = "https://url" ``` -------------------------------- ### API Class Order - Simple List Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Customize the order of classes in the API documentation by providing a list of class names to the `classOrder` option. ```toml classOrder = [ "MyClass", "Sample" ] ``` -------------------------------- ### Documenting Item Addition Version with @since Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md The `@since` tag specifies the version of the library in which a function was introduced. This helps users understand compatibility. ```lua --- @since v1.2.3 function MyClass:recentFunction() end ``` -------------------------------- ### Configuring API Categories with moonwave.toml Source: https://context7.com/evaera/moonwave/llms.txt The `moonwave.toml` file can be used to define API categories that correspond to the `@tag` labels used in doc comments, enabling better organization of documentation. ```toml # moonwave.toml — expose tags as TOC categories apiCategories = ["Player", "NPC", "Moderation"] ``` -------------------------------- ### Configure Nested Section Label and Position Source: https://github.com/evaera/moonwave/blob/master/website/docs/Docs.md Create a `_category_.json` file in a subfolder to customize the label and position of nested documentation sections. ```json { "label": "Tutorial", "position": 3 } ``` -------------------------------- ### API Class Order - Sections Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Organize API classes into named sections using the `[[classOrder]]` structure. This allows for categorized API documentation. ```toml [[classOrder]] section = "Section name" classes = ["Class1", "Class2"] [[classOrder]] section = "Another section name" classes = ["Class3", "Class4"] [[classOrder]] section = "Tag Section" # You can add tagged classes with '@tag ' to a section like this tag = "TagForClasses" [[classOrder]] # No section name will link classes at the root level of the sidebar classes = ["Class5", "Class6"] [[classOrder]] section = "Yet another section name" collapsed = false # Determines with the section grouping is collapsed or expanded on page load. Defaults to true. classes = ["Class7", "ClassAte", "Class9"] ``` -------------------------------- ### Configuring API Categories in moonwave.toml Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Specify the tags that should form categories in your API documentation by listing them in the `apiCategories` array within your `moonwave.toml` file. ```toml apiCategories = [ "constructor", "utility", "random" ] ``` -------------------------------- ### Visibility Control: @private, @ignore Source: https://context7.com/evaera/moonwave/llms.txt Use @private to hide members by default and @ignore to suppress them entirely from the website. ```lua --- @prop _cache {[string]: any} --- @within MyService --- @private --- Internal cache. Do not access from outside the module. --- @function _validateInput --- @within MyService --- @ignore --- Internal validation helper. Not part of the public API. ``` -------------------------------- ### Lifecycle Tags: @deprecated, @since, @unreleased Source: https://context7.com/evaera/moonwave/llms.txt Document the lifecycle of members using @deprecated, @since, and @unreleased tags. @deprecated requires a version and optional migration note. ```lua --- @deprecated v2.0 -- Use `MyService:connectAsync` instead. --- @since v1.0 function MyService:connect() end --- @since v2.0 function MyService:connectAsync() end --- @unreleased function MyService:experimentalFeature() end ``` -------------------------------- ### README Content Control for Home Page Source: https://context7.com/evaera/moonwave/llms.txt Use HTML comments in `README.md` to control which sections are included on the custom home page. ```html This intro will be visible. This installation section will be hidden from the homepage. This getting-started content will be visible again. ``` -------------------------------- ### Project Structure for Moonwave Overrides Source: https://context7.com/evaera/moonwave/llms.txt Place project-level overrides in the .moonwave/ directory at the root of your project. This includes static files, custom CSS, and sidebar configurations. ```directory .moonwave/ ├── static/ # Files served at the website root (images, CNAME, etc.) │ └── logo.png # Available at website.com/logo.png ├── custom.css # Global CSS overrides └── sidebars.js # Custom docs sidebar configuration ``` -------------------------------- ### Specify Source Code Folder Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md If your Lua source code is not in the default `src` or `lib` folders, use the `--code` flag with the `moonwave dev` command to specify the correct directory. ```bash moonwave dev --code MyFolderHere ``` -------------------------------- ### Specifying Realm Availability with @server and @plugin Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md These tags indicate where an item can be used. `@server` restricts usage to the server-side, while `@plugin` restricts it to within plugins. Multiple realm tags can be combined. ```lua --- @server --- @plugin function MyClass:foo() end ``` -------------------------------- ### Document a Class Method Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md Document a function within a class using a doc comment placed directly above the function definition. Use tags like `@param` and `@return` to describe arguments and return values. ```lua --[=[This is a very fancy function that adds a couple numbers. @param a number -- The first number you want to add @param b number -- The second number you wanna add @return number -- Returns the sum of `a` and `b` ]=] function MyFirstClass:add(a, b) return a + b end ``` -------------------------------- ### Parameters and Return Values Source: https://context7.com/evaera/moonwave/llms.txt Document function parameters using `@param` and return values using `@return`. Moonwave can auto-detect Luau types. ```APIDOC ## `MyService:search` ### Description Searches for items matching a query. ### Parameters #### Path Parameters * `query` (string) - Required - The search string. * `maxResults` (number) - Required - Maximum number of results to return. * `caseSensitive` (boolean) - Optional - Whether the match is case-sensitive. Defaults to false. ### Response #### Success Response (200) * `results` (table) - Array of matching item names. * `totalMatches` (number) - Total number of matches found (may exceed maxResults). ### Request Example ```lua MyService:search("example", 10, true) ``` ### Response Example ```lua { "results": ["item1", "item2"], "totalMatches": 5 } ``` ``` ```APIDOC ## `MyService:recordScore` ### Description Records a player's score. ### Parameters #### Path Parameters * `name` (string) - Required - The player's display name. * `score` (number) - Required - Their score to record. ### Response #### Success Response (200) * `success` (boolean) - Whether the record was saved successfully. ### Request Example ```lua MyService:recordScore("Player1", 1000) ``` ### Response Example ```lua { "success": true } ``` ``` -------------------------------- ### Documenting a Class with @class Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the `@class` tag to denote a class definition. It's conventionally placed before the class definition. ```lua --- @class MyClass --- A sample class. local MyClass = {} MyClass.__index = MyClass ``` -------------------------------- ### Realm Tags: @server, @client, @plugin Source: https://context7.com/evaera/moonwave/llms.txt Use realm tags to specify where a class or member is available. Multiple tags can be combined. ```lua --- @class DataManager --- @server --- Manages persistent player data. Only accessible from server scripts. local DataManager = {} --[=[ Reads a player's saved data. @server @param userId number -- The player's UserId. @return {} -- The saved data table. ]=] function DataManager:read(userId) end --[=[ Renders a local HUD element. @client @param config {} -- HUD configuration. ]=] function HUD:render(config) end --[=[ Opens the plugin settings panel. @plugin ]=] function PluginTool:openSettings() end ``` -------------------------------- ### Documenting Methods with @method Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the @method tag when documenting a method, especially when the function definition is missing. Ensure to specify the class using @within. ```lua --[=[ This is a very fancy function that adds a couple numbers. @method add @within MyClass @param a number -- The first number you want to add @param b number -- The second number you wanna add @return number -- Returns the sum of `a` and `b` ]=] ``` -------------------------------- ### Documenting Return Values with @return Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the @return tag to describe function return values, including their type and an optional description. Return types are auto-detected with Luau type annotations, but manual specification overrides auto-detection. ```lua --[=[ @return number -- Some number @return number ]=] function MyClass:doSomething() return 1, 2 end ``` -------------------------------- ### Documenting Unreleased Items with @unreleased Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the `@unreleased` tag to indicate that an item is not yet released and might only be functional in pre-release versions. ```lua --- @unreleased ``` -------------------------------- ### Lua/Luau Type Annotations for Moonwave Source: https://context7.com/evaera/moonwave/llms.txt Use Luau-compatible type syntax for documentation annotations in Moonwave. This covers primitive types, optional/nullable types, arrays, unions, generics, and function types. ```lua -- Primitive types --- @param name string --- @param count number --- @param flag boolean --- @param value any -- Optional / nullable (all three are equivalent) --- @param opt string? --- @param opt string | nil --- @param opt? string -- Arrays --- @param tags {string} --- @param matrix {{number}} -- Union types --- @param input number | string --- @return boolean | nil -- Generic types --- @return Promise --- @param transform (T) -> T -- Function types --- @param callback (name: string, count: number) -> () --- @param getter () -> string --- @param multi (x: number) -> (number, number) ``` -------------------------------- ### Configure Git Source Branch Source: https://github.com/evaera/moonwave/blob/master/website/docs/Publishing.md If your master branch is not named 'master', configure the gitSourceBranch in your moonwave.toml file to ensure 'Edit this page' links work correctly. ```toml gitSourceBranch = "main" ``` -------------------------------- ### Documenting Functions with @function and @method Source: https://context7.com/evaera/moonwave/llms.txt Place a doc comment directly above a function definition. Use `@function` or `@method` for auto-generated functions. `@method` signals invocation with `:` instead of `.`. ```lua --[=[Creates a new MyService instance. @param namespace string -- A unique namespace for network isolation. @return MyService -- The new service instance. @error "BadNamespace" -- Thrown if namespace is empty. ]=] function MyService.new(namespace) return setmetatable({ _namespace = namespace }, MyService) end ``` ```lua --[=[Fires a named event on this service. @param eventName string -- The event to fire. @param ... any -- Arguments forwarded to all listeners. @yields ]=] function MyService:fire(eventName, ...) -- implementation end ``` ```lua -- Documenting a virtual / auto-generated method with @method: --[=[@method destroy @within MyService @param self MyService -- The instance to clean up. @return nil Cleans up all resources held by this service. ]=] ``` -------------------------------- ### Documenting Functions with @function Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the @function tag to document functions that do not appear in the file or are auto-generated. For methods, use @method. ```lua --[=[ This is a very fancy function that adds a couple numbers. @param a number -- The first number you want to add @param b number -- The second number you wanna add @return number -- Returns the sum of `a` and `b` ]=] function MyClass:add(a, b) return a + b end ``` -------------------------------- ### Specifying __index Table Name with @__index Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md When the `__index` table for a class is not named `__index`, use `@__index ` to specify its actual name so Moonwave can correctly detect class methods. ```lua --[[ A function @method MyClass.prototype:method ]] function MyClass.prototype:method() end ``` -------------------------------- ### Documenting Properties Source: https://context7.com/evaera/moonwave/llms.txt Document class properties using `@prop`. Use `@readonly` for non-writable properties and `@private` for internal ones. ```APIDOC ## `MyService.Name` ### Description The human-readable name of this service instance. ### Type string ### Readonly false ``` ```APIDOC ## `MyService._internalCache` ### Description Internal cache — not part of the public API. ### Type {[string]: any} ### Readonly false ### Private true ``` ```APIDOC ## `MyService.Version` ### Description The current version string. Do not modify. ### Type string ### Readonly true ### Since v1.0 ``` ```APIDOC ## `MyService.ActiveConnections` ### Description Number of currently active connections. ### Type number ### Readonly true ``` -------------------------------- ### Custom __index Table Name: @__index Source: https://context7.com/evaera/moonwave/llms.txt Specify a custom prototype table name with @__index when it's not directly __index. ```lua --[=[ @class Widget @__index prototype ]=] local Widget = {} Widget.prototype = {} Widget.__index = Widget.prototype --- Renders the widget to the screen. function Widget.prototype:render() end ``` -------------------------------- ### Documenting Function Parameters with @param Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the @param tag to describe function parameters, including their name, type, and an optional description. Parameter names and types are auto-detected with Luau type annotations. ```lua --[=[ @param a number -- The first number you want to add @param b number ]=] function MyClass:doSomething(a, b) end ``` ```lua --[=[ Example of only specifying description, using the auto-detected Luau type annotation. @param myParam -- Description of myParam ]=] function MyClass:typeAnnotationExample(myParam: string) end ``` -------------------------------- ### Custom Docs Sidebar Configuration Source: https://github.com/evaera/moonwave/blob/master/website/docs/StaticFiles.md Define a custom ordering, sections, and exclusions for the docs sidebar using a JavaScript configuration file. Refer to Docusaurus documentation for more details. ```javascript module.exports = { mySidebar: [ { type: "doc", id: "getting-started", label: "Getting Started", }, { type: "category", label: "Moonwave", items: ["moonwave-basics, moonwave-advances"], }, { type: "category", label: "Other Resources", items: [ "nested-folder/extra-resources", "another-folder/even-more-resources", ], }, ], } ``` -------------------------------- ### Define a Moonwave Class (Multi-line Comment) Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md Define a Moonwave class using a multi-line comment with `--[=[ ... ]=]` syntax. The `@class` tag identifies the class name. This is equivalent to the triple-dash comment method. ```lua --[=[@class MyFirstClass This is my first class. ]=] local MyFirstClass = {} MyFirstClass.__index = MyFirstClass ``` -------------------------------- ### Documenting Class Properties with @prop Source: https://context7.com/evaera/moonwave/llms.txt Declare documented properties using `@prop `. Use `@readonly` for non-writable properties and `@private` for internal ones. Properties are conventionally placed near the class definition. ```lua --- @prop Name string --- @within MyService --- The human-readable name of this service instance. --- @prop _internalCache {[string]: any} --- @within MyService --- @private --- Internal cache — not part of the public API. --- @prop Version string --- @within MyService --- @readonly --- @since v1.0 --- The current version string. Do not modify. ``` -------------------------------- ### Indicating Server-Only Availability with @server Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use the `@server` tag to explicitly state that an item is intended for server-side execution only. ```lua --- @server ``` -------------------------------- ### Automatic Sections from Folders Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Automatically categorize API classes into sections based on their folder structure using the `autoSectionPath` option. Folder names are converted to Title Case. ```toml autoSectionPath = "packages" ``` -------------------------------- ### Marking Deprecated Items with @deprecated Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use `@deprecated` to mark an item as obsolete. Include the deprecation version and an optional description suggesting an alternative. Markdown is supported in the description. ```lua --- @deprecated v2 -- Use `goodFunction` instead. function MyClass:badFunction() end ``` -------------------------------- ### Custom Navbar Items Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Add custom items to the navigation bar by defining them within the `[[navbar.items]]` array in `moonwave.toml`. ```toml [[navbar.items]] href = "https://discord.gg/abcdefghijk" label = "Discord" position = "right" [[navbar.items]] href = "https://???" label = "Something Else" ``` -------------------------------- ### Define a Moonwave Class (Triple-Dash Comment) Source: https://github.com/evaera/moonwave/blob/master/website/docs/intro.md Define a Moonwave class using triple-dash single-line comments (`---`). The `@class` tag identifies the class name. This is equivalent to the multi-line comment method. ```lua --- --- @class MyFirstClass --- --- This is my first class. local MyFirstClass = {} MyFirstClass.__index = MyFirstClass ``` -------------------------------- ### Indicating Client-Only Availability with @client Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md The `@client` tag denotes that an item is exclusively available for use on the client-side. ```lua --- @client ``` -------------------------------- ### Ignoring Items from Documentation with @ignore Source: https://github.com/evaera/moonwave/blob/master/website/docs/TagList.md Use `@ignore` to prevent an item's documentation from appearing on the generated website, while still allowing tools like language servers to access its information. ```lua --- @ignore ``` -------------------------------- ### Documenting Table Shapes with @interface Source: https://context7.com/evaera/moonwave/llms.txt Document the shape of tables used as arguments or return values with `@interface `. Fields can be declared using dot-syntax or `@field` tags. ```lua --[=[ @interface Config @within MyService .Host string -- The server hostname. .Port number -- The port to connect on. .Timeout number? -- Optional connection timeout in seconds. @field Retries number -- Number of reconnect attempts. Configuration object passed to MyService.connect(). ]=] --[=[ Connects using the provided configuration. @param config Config -- Connection settings. @return boolean -- True if the connection succeeded. ]=] function MyService.connect(config) -- implementation end ``` -------------------------------- ### Tagging API Items for Categories Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Use the `@tag` annotation within Lua doc comments to assign items to specific categories. These categories can then be configured in `moonwave.toml`. ```lua --[=[ This is a very fancy function that adds a couple numbers. @param a number -- The first number you want to add @param b number -- The second number you wanna add @return number -- Returns the sum of `a` and `b` @tag utility ]=] function MyFirstClass:taggedFunction(a, b) return a + b end ``` -------------------------------- ### Table Shape Documentation Source: https://context7.com/evaera/moonwave/llms.txt Document the shape of tables used as arguments or return values using `@interface`. ```APIDOC ## `MyService.Config` ### Description Configuration object passed to MyService.connect(). ### Fields * `.Host` (string) - The server hostname. * `.Port` (number) - The port to connect on. * `.Timeout` (number) - Optional connection timeout in seconds. * `.Retries` (number) - Number of reconnect attempts. ``` -------------------------------- ### External Linking: @external Source: https://context7.com/evaera/moonwave/llms.txt Link to external types using @external . The type name becomes a clickable link in documentation. ```lua --[=[ Returns a Promise that resolves with the fetched data. @function fetchData @within MyService @external Promise https://eryn.io/roblox-lua-promise/api/Promise @param url string -- The endpoint to fetch. @return Promise -- Resolves with the response body string. ]=] ``` -------------------------------- ### Hiding README Content Before a Comment Source: https://github.com/evaera/moonwave/blob/master/website/docs/Configuration.md Use the `` HTML comment in your README to hide all content that appears before this marker on the home page. ```html All content behind this comment will be hidden. While everything in between both comments will be visible! And everything ahead of this comment will also be hidden. ``` -------------------------------- ### Adding Visual Labels with @tag Source: https://context7.com/evaera/moonwave/llms.txt Attach visual badge labels to class members using `@tag