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.
Technical Setup
Section titled “Technical Setup”Before you can contribute, you need to set up the documentation engine on your local machine to preview your changes.
-
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] -
Use
npmto install the required packages:Terminal window npm install -
Start the development server:
Terminal window npm run devThe site is typically available at
http://localhost:6969/csp-lua-api-docs/.
Repository Structure
Section titled “Repository Structure”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
Documentation Standards
Section titled “Documentation Standards”To maintain consistency across the API reference, all pages must follow a standardized structure and writing style.
Page Anatomy
Section titled “Page Anatomy”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.
-
Frontmatter
Section titled “Frontmatter”Every page starts with a
YAMLblock. Thetitleshould be the full Lua name (e.g.,ac.getCar), and thedescriptionshould be a concise summary of what it does. Thedescriptionis what is presented along with embedded links. -
Summary & Context
Section titled “Summary & Context”A one- or two-sentence high-level explanation. Use
<Aside>components here for critical warnings or version requirements. -
Usage Patterns
Section titled “Usage Patterns”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. -
Description
Section titled “Description”A deeper dive into the behavior, logic, and edge cases. Prefer prose over bullet points here.
-
Parameters & Return Values
Section titled “Parameters & Return Values”Use standard Markdown tables to define inputs and outputs. Include types like
integer,number,string,vec3, or links to custom objects. -
Examples
Section titled “Examples”Practical, copy-pasteable code snippets using
<Tabs>to categorize different use cases (e.g., “Basic Usage”, “Advanced Logic”).
Writing Style
Section titled “Writing Style”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
ifstatements orforloops work. Assume the reader knows Lua and is here specifically for the CSP API. - Use
backticksfor code symbols, function names, and variable names in prose. - Avoid normative or opinionated language such as “should”, “best”, or “recommended” unless strictly required.
Code Example Guidelines
Section titled “Code Example Guidelines”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.