Skip to content

Contributing Guide

This guide describes the workflow and standards for contributing to the CSP Lua API Documentation. It covers technical setup, repository structure, and documentation conventions.

Before you can contribute, you need to set up the documentation engine on your local machine to preview your changes.

  1. Ensure you have Node.js and Git installed.

  2. Fork the repository on GitHub and clone it to your machine:

    Terminal window
    git clone https://github.com/lint069/csp-lua-api-docs.git [name-of-folder]
    cd [name-of-folder]
  3. Use npm to install the required packages:

    Terminal window
    npm install
  4. Start the development server:

    Terminal window
    npm run dev

    The site is typically available at http://localhost:6969/csp-lua-api-docs/.

All documentation content lives under src/content/docs/. Each top-level directory corresponds to a namespace or documentation category.

When adding a new page, ensure it is placed in the correct directory.

  • Directorysrc/
    • Directorycontent/
      • Directorydocs/
        • Directoryac/ Namespace
          • Directoryenums/ Enumerations
          • Directoryobjects/ Structs and Objects
        • Directoryio/
        • Directoryui/
        • Directory…/
        • Directory…/
        • Directory…/
        • Directoryprimitives/ Primitive Types
        • Directorycommunity/ About Us
          • contributing.mdx This Page

To maintain consistency across the API reference, all pages must follow a standardized structure and writing style.

Most API reference pages should follow this specific order. If a section is not applicable (e.g., a function has no parameters), it may be omitted, but the relative order must be preserved. Do not reorder sections for stylistic reasons. Consistency across pages is more important than individual preference.

  1. Every page starts with a YAML block. The title should be the full Lua name (e.g., ac.getCar), and the description should be a concise summary of what it does. The description is what is presented along with embedded links.

  2. A one- or two-sentence high-level explanation. Use <Aside> components here for critical warnings or version requirements.

  3. Use <Tabs> to show the most common ways to call the function. This provides immediate value to the reader before they dive into any technical details.

  4. A deeper dive into the behavior, logic, and edge cases. Prefer prose over bullet points here.

  5. Use standard Markdown tables to define inputs and outputs. Include types like integer, number, string, vec3, or links to custom objects.

  6. Practical, copy-pasteable code snippets using <Tabs> to categorize different use cases (e.g., “Basic Usage”, “Advanced Logic”).

We write for a technically competent audience. Avoid “fluff” and conversational language.

  • Write in a declarative, factual style.
  • Exclude lead-in labels.
  • Do not explain how if statements or for loops work. Assume the reader knows Lua and is here specifically for the CSP API.
  • Use backticks for code symbols, function names, and variable names in prose.
  • Avoid normative or opinionated language such as “should”, “best”, or “recommended” unless strictly required.

Code examples are the most important part of the documentation.

  • Show only the code necessary to demonstrate the specific API, avoiding large “scaffolding” code.
  • Use realistic variable names, and scenarios that a user would actually encounter.
  • Use comments sparingly to explain why something is happening, not what the Lua syntax is doing.