by stevedonovan

stevedonovan /LDoc

A LuaDoc-compatible documentation generation system

442 Stars 120 Forks Last release: Not found Other 487 Commits 29 Releases

Available items

No Items, yet!

The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:

LDoc - A Lua Documentation Tool

Copyright (C) 2011-2012 Steve Donovan.


This project grew out of the documentation needs of Penlight (and not always getting satisfaction with LuaDoc) and depends on Penlight itself.(This allowed me to not write a lot of code.)

The API documentation of Penlight is an example of a project using plain LuaDoc markup processed using LDoc.

LDoc is intended to be compatible with LuaDoc and thus follows the pattern set by the various *Doc tools:

--- Summary ends with a period.
-- Some description, can be over several lines.
-- @param p1 first parameter
-- @param p2 second parameter
-- @return a string value
-- @see second_fun
function mod1.first_fun(p1,p2)

Tags such as

are supported, and generally the names of functions and modules can be inferred from the code.

LDoc is designed to give better diagnostics: if a

reference cannot be found, then the line number of the reference is given. LDoc knows about modules which do not use
- this is important since this function has become deprecated in Lua 5.2. And you can avoid having to embed HTML in commments by using Markdown.

LDoc will also work with Lua C extension code, and provides some convenient shortcuts.

An example showing the support for named sections and 'classes' is the Winapi documentation; this is generated from winapi.l.c.


This is straightforward; the only external dependency is Penlight, which in turn needs LuaFileSystem. These are already present in Lua for Windows, and Penlight is also available through LuaRocks as

luarocks install

Unpack the sources somewhere and make an alias to

on your path. That is, either an excutable script called 'ldoc' like so:
lua /path/to/ldoc/ldoc.lua $*

Or a batch file called 'ldoc.bat':

@echo off
lua \path\to\ldoc\ldoc.lua %*

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.