Giter VIP home page Giter VIP logo

howl's Introduction

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

howl's People

Contributors

arkt8 avatar

Stargazers

Andrew Chou avatar

Watchers

Andrew Chou avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.