
A powerful API documentation generator for Lua (minimum supported version 5.1.5).
The goal of this project is to provide a versatile block documentation comment format that can be used by IDEs such as VS Code to annotate code symbols in Lua scripts and Luarocks packages.
This project is a remake of LDoc and the Docbunto script used on MediaWiki projects.
Documentation is contributed by Lua symbols in the form of static comment markup using the @ symbol.
These are provided and maintained by the developer during the code implementation:
--- Item summary.
-- The item description follows. Information provided by the item comment
-- can be formatted with '''MediaWiki''' and **Markdown** syntax.
-- The comments can generally span multiple lines.
--
-- By leaving empty comment lines, a new paragraph can be made in the
-- documentation. This can be used to give longer explanations whitespace.
--
-- @script lunardoc
-- @param {table} options Configuration options.
-- @param[opt] {boolean} options.all Include local items in documentation.
-- @param[opt] {string} options.simple Limit documentation to descriptions.
-- @param[opt] {string} options.colon Format tags with a `:` suffix.
-- @return {string} Compiled documentation.
The block description in Lunardoc comments is prefixed by the character sequence --- or --[[.
Similar to other competing comment standards, documentation can be triggered by a comment containing a tag.
In essence, just put a -- @param tag and it'll work.
| Format |
Active? |
Documented? |
Mixed mode* |
Conflict prevention |
Type support |
| LuaDoc |
No |
Yes |
Yes |
No |
No |
| LDoc |
Active |
Yes |
Yes |
No |
No |
| EmmyLua |
Active |
No |
Yes |
Yes |
Yes |
| Lunardoc |
Active |
Yes |
Yes |
Yes |
No |
- LuaDoc: uses
--- for block descriptions
- LDoc: uses
--[[ and --- for block descriptions
- EmmyLua: uses
---- for block descriptions
These @-tags and surrounding markup are parsed by the library's taglet and used to generate Markdown output.
The underlying "taglet" API that generates the documentation is designed for consumption in other Lua modules and the VS Code language server for Lua.
The package supports 52 documentation tags. These are prefixed with @ as a key for the documentation message in the documentation output. Where applicable multiple entries of one @tag are acceptable and are rendered as a list.
The full list is available on the original Docbunto documentation page.
Some developers avoid documentation generators because they aim to protect their codebase from "doctag soup" AKA @ fatigue. To bypass this DX issue, Lunardoc has a colon mode where tags are suffixed with : instead.
| Name |
Aliases |
Category |
Permitted context |
Typing |
@function |
@lfunction |
Item type |
Item |
function |
| Name |
Aliases |
Category |
Permitted context |
Typing |
@table |
@property |
Item type |
Item |
table |
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@member |
|
Item type |
Item |
{type} |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@variable |
|
Item type |
Item |
{type} |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@section |
|
Item type |
Item |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@type |
|
Item type |
Item |
Tag.value |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@usage |
@code |
|
Module; Item |
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@param |
@argument |
|
Module; Item |
{type} |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@field |
|
|
Item |
{type} |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@error |
@raise
@throws
@exception |
|
Module; Item |
{type} |
Line number |
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@return |
|
|
Module; Item |
{type} |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@tfield |
|
|
|
type |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@tparam |
|
|
|
type |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@treturn |
|
|
|
type |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@bool |
|
|
|
boolean |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@func |
|
|
|
function |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@int |
|
|
|
number |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@number |
|
|
|
number |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@string |
|
|
|
string |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@tab |
|
|
|
table |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@module |
@package |
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@script |
|
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@classmod |
|
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@submodule |
|
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@example |
|
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@field |
|
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@topic |
|
Module type |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@image |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@caption |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@release |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@author |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@copyright |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@license |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@require |
@requires |
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@credit |
@credits |
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@attribution |
|
Module info |
Module |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@local |
|
Flag |
Item |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@export |
|
Flag |
Inline |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@private |
|
Flag |
Item |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@constructor |
|
Flag |
Item |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@static |
|
Flag |
Item |
N/A |
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@class |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@name |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@alias |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@summary |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@description |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@warning |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@fixme |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@note |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@todo |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@see |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@pragma |
|
|
|
|
|
| Name |
Aliases |
Category |
Permitted context |
Typing |
Modifiers |
@factory |
|
|
|
|
|