Skip to content

Docs - Auto generate examples docs #300

@VaclavElias

Description

@VaclavElias

Can we auto generate docs for easier maintance?

See the header here https://www.raylib.com/examples/core/loader.html?name=core_input_keys

Similar could be generated for the examples docs.

Structure

  • Category: Keep a single primary Category for navigation. Use Tags for cross-cutting facets. If you ever need multiple, add a separate optional Categories: [] later, but don’t rely on it now.
  • Complexity: Yes, include Complexity: 1–5. It’s useful for sorting and filtering.
  • Loading meta: Don’t parse source at runtime in production. Generate a manifest (JSON) at build time and load that in the launcher. Optionally allow runtime scanning only in dev-mode as a fallback.

Recommended schema strategy

  • Required fields: Id, Title, Category, Level, Complexity, Order
  • Optional: Description, Concepts[], Related[], Tags[]
  • Level values (controlled): GettingStarted, Basic, Intermediate, Advanced
  • Category values (controlled, single): Core, Shapes, Materials, Textures, Cameras, Lighting, Physics, UI, Input, Audio, Rendering, Shaders, Models, Particles, Networking, Tools
  • Tags: free-form, but normalize to kebab-case for filters (e.g., capsule, primitive, scene-setup, transform, skybox)

Tags for this example

  • capsule, primitive, shapes, transform, position, skybox, scene-setup, getting-started

Loader/Docs flow

  • Build-time extraction (recommended):
    • A small extractor scans examples for EXAMPLE_META, validates the schema, and emits examples-manifest.json.
    • For Blazor WASM launcher: place the JSON in wwwroot and fetch it.
    • For Blazor Server or desktop launcher: load from content file or embedded resource.
  • Runtime extraction (dev-only fallback):
    • If manifest missing, scan Program.cs files at startup, extract EXAMPLE_META, and cache the result. This won’t work for WASM and is slower, so keep it for development only.

Operational notes

  • Use Id derived from the example folder name to keep links stable.
  • Sorting: Level > Category > Order > Title.
  • Validation: add a CI step to ensure every example contains valid metadata and uses allowed Level/Category values.
  • Forward compatibility: you can later add Categories: [] without breaking existing consumers; prefer Category for primary grouping.

Example

/*
EXAMPLE_META_START
Title: Basic3D Scene (Capsule)
Category: Shapes
Level: Getting Started
Complexity:1
Order:1
Description: |
 Create a minimal 3D scene using toolkit helpers and place a single capsule primitive.
 Demonstrates entity creation, basic positioning, and attaching the entity to the scene.
Concepts:
 - Creating a 3D primitive (Capsule)
 - Positioning an entity with Transform.Position
 - Adding entities to a Scene (rootScene)
 - Using helpers: SetupBase3DScene and AddSkybox
Related:
 - Example02_GiveMeACube
 - Example01_Basic3DScene_Primitives
 - Example01_Material
Tags:
 -3D
 - Shapes
 - Primitive
 - Capsule
 - Scene Setup
 - Skybox
 - Transform
 - Position
 - Getting Started
EXAMPLE_META_END
*/

Sub-issues

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentation

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions