Skip to content

Define Markdown schema (DSL) for API reference docs #297

Description

@mark-wiemer

Right now, the docs are all in lua_api.md, 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.

This schema can also be referred to as a DSL, or domain-specific language, because it needs to be unambiguous so that machines can consistently interpret it. As such, it'll be a DSL for Luanti documentation!

Considerations

  • Ease of contribution
    • Clarity of schema for new contributors without automated tooling assistance (e.g. editing in Notepad or online editor)
    • Simplicity of contributing (e.g. copy-pasting HTML boilerplate vs handwriting Markdown)
  • Ease of scanning plaintext

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(): ...

Metadata

Metadata

Assignees

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