Skip to content

Define Markdown schema for API reference docs #297

@mark-wiemer

Description

@mark-wiemer

Right now, the docs are all in lua_api.md#core-namespace-reference, where the only requirement is "valid Markdown" (really, it just needs to pass human review). This has resulted in various issues, namely that some function args have unclear types. A stricter Markdown schema would ensure that all necessary information is documented for each function, and a check can be automated. This issue focuses simply on defining the schema, not yet implementing the checks.

Criteria

  • Return types documented
  • Argument types documented
  • All information about the function should be nested within the same section (see below)
  • more to be discussed...

All information about the function should be nested within the same section

Details

For example, in the snippet below, the table description is not syntactically nested under the list, and would be hard to parse:

- `core.get_game_info()`: returns a table...
{
   id = string,
   ...
}
- `core.get_world_path()`: ...

When rendered, the table description ends the list, then the next bullet starts a new list:

  • core.get_game_info(): returns a table...
{
   id = string,
   ...
}
  • core.get_world_path(): ...

A more correct snippet would indent the table definition:

- `core.get_game_info()`: returns a table...
   {
      id = string,
      ...
   }
- `core.get_world_path()`: ...

Now the table description is clearly nested under the get_game_info list item:

  • core.get_game_info(): returns a table...
    {
       id = string,
       ...
    }
  • core.get_world_path(): ...

Secondary considerations

  • Ease of scanning plaintext

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions