waxlab/howl
Archived
2
1
Fork
You've already forked howl
0
Documentation extractor for markdown-like comments on Lua files.
This repository has been archived on 2024年02月19日. You can view files and clone it, but you cannot make any changes to its state, such as pushing and creating new issues, pull requests or comments.
  • Lua 100%
Thadeu de Paula 3319ea55d4 Improve Wiki format, Add Vim help format
- Wiki format with documents from Markdown prepended to the
 api documents (generated from Lua files)
- Vim help formatting
- Added a inner concept of `conf` table to be passed around
 and make easy to extend in future.
- Included a readme with basic instruction
2022年11月28日 15:49:01 -03:00
bin Improve Wiki format, Add Vim help format 2022年11月28日 15:49:01 -03:00
lib Improve Wiki format, Add Vim help format 2022年11月28日 15:49:01 -03:00
.gitignore Improve Wiki format, Add Vim help format 2022年11月28日 15:49:01 -03:00
howl-1.0-1.rockspec Improve Wiki format, Add Vim help format 2022年11月28日 15:49:01 -03:00
LICENSE Improve Wiki format, Add Vim help format 2022年11月28日 15:49:01 -03:00
readme.md Improve Wiki format, Add Vim help format 2022年11月28日 15:49:01 -03:00

Howl - Markdown-like documentation generation

Quickstart

  1. Install howl:
 luarocks install howl
  1. Create a test folder inside your project

  2. Write a Lua script on the file test/example.lua

 function my_sum(a, b)
 return a+b
 end
 function my_mult(a, b)
 return a*b
 end
  1. Add comments on your script
 --| # My howl test title
 --| This is a common markdown line explaining how it works
 --| spanning through multiple lines.
 --|
 --| And this is another plain text paragraph.
 --|
 --$ my_sum(a: number, b:number) : number
 --{
 function my_sum(a, b)
 return a+b
 end
 --}
 function my_mult(a, b)
 return a*b
 end
  1. Run howl to extract help and code to your documentation.
 howl --from ./test --fmt wiki ./mywiki

You will see the mywiki folder be created with your documentation.

Markdown-like

To use howl you need to know only how to write Markdown, Lua and the meaning of 4 marks added after the comment start.

  1. --| start a comment line containing pure markdown;
  2. --$ start a comment indicating a code signature;
  3. --{ when fills an entire line indicates that the subsequent lines of Lua code should be included inside the documentation.
  4. --} when fills an entire line indicates the end of code block that should be included in the documentation. Basically it closes the block opened by --{.

As example, in the resulting markdown from Howl, the example given in quickstart becomes like this:

 # My howl test title
 This is a common markdown line explaining how it works
 spanning through multiple lines.
 And this is another plain text paragraph.
 ###### my_sum
 - `my_sum(a: number, b:number) : number`
 ```lua
 function my_sum(a, b)
 return a+b
 end
 ```

Observe how the signature is rewritten to the documentation as a title and as a code markup. Look also how only the marked block between --{ and --} is include and properly marked as Lua code (to be rendered with Lua syntax).

CLI Options

  • --from <dirname> Indicates where the Lua and Markdown source files should be found. You can specify many directories. Howl look for *.lua and *.md recursively inside these directories.
  • --fmt <format> Indicates the target format output. Currently there are only two formats:
    • wiki that generates multiple markdown files, a Home.md and a _Sidebar.md to be used in Gitea wiki.
    • vim that generates a single text file intended to be used as a vim help. See the vim or neovim :help helptags to understand how to use the generated vim help file.

Project status

Howl became from the need to provide simple and objective way to document Lua modules in the wax project (look that for a living example of the result).

It already accomplish the documentation generation for user needs (via Wiki) and personal/offline needs (via Vim Help). You can annotate any Lua code since Lua 5.1+, but the Howl executor needs at least 5.2 to make text parsing easier.

You can easily extend it adding new parsers (to read other than Lua and Markdown) or adding new formatters (like HTML, XML, JSON etc.) Feel free to contribute to this project.

Contributing

You can contribute reporting or fixing bugs or sending new formatters/parsers.

In case of contributing with new formatters or parsers, provide examples and tests and keep the simplicity of code :)