Use ldoc to generate teal type definitions
Go to file
Jordan Irwin 147951025b
Add option to show a project icon (Issue #307, PR #315)
2021-05-10 20:16:55 +03:00
.github/workflows update Github Actions for Lua and LuaRocks 2021-03-27 12:22:18 +01:00
doc Add option to show a project icon (Issue #307, PR #315) 2021-05-10 20:16:55 +03:00
ldoc Add option to show a project icon (Issue #307, PR #315) 2021-05-10 20:16:55 +03:00
tests moonscript fat arrow and auto-assign ctor support 2016-06-27 11:48:35 +02:00
.luacheckrc chore: Setup luacheck config file for project 2020-10-02 01:06:17 +03:00
CHANGELOG.md Rename standard files with traditional names 2020-09-30 02:30:07 +03:00
COPYRIGHT a custom styling example 2011-06-13 15:43:28 +02:00
Makefile fix: Test targets compare non-existent directory 2020-10-02 01:06:18 +03:00
README.md chore: Add status badge for linter to readme 2020-10-02 01:06:17 +03:00
ldoc-scm-3.rockspec Add 'new' theme and switch LDoc's own documentation to it (#287) 2020-09-30 00:16:16 +03:00
ldoc.lua Add option to show a project icon (Issue #307, PR #315) 2021-05-10 20:16:55 +03:00
run-tests.lua fix: Use current repository ldoc for tests, not system installed one 2020-10-02 01:06:18 +03:00

README.md

LDoc - A Lua Documentation Tool

Luacheck

Copyright (C) 2011-2012 Steve Donovan.

Rationale

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)
end

Tags such as see and usage 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 @see reference cannot be found, then the line number of the reference is given. LDoc knows about modules which do not use module()

  • 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.

Installation

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 penlight.

Unpack the sources somewhere and make an alias to ldoc.lua on your path. That is, either an executable 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 %*