lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

I'm pleased to announce the release of lua-discount This
release offers Windows support thanks to contributions from Tim
Channon. Thanks to Hisham Muhammad for getting a win32-x86 binary rock
into the repository. Anyone running on Mac, Linux or Windows should be
able to install lua-discount by typing `luarocks install

# lua-discount

A binding to [Discount](, a
fast C implementation of the
[Markdown]( text to HTML markup
system. Discount passes the Markdown test suite.

## Project links
* [Home](
* [Download](
* [Documentation](
* [Source](

## Release history
* lua-discount- (2008-09-22)
  * Windows is now a supported platform (thanks to contributions from Tim
* lua-discount-1.2.10 (2008-09-03)
  * update to upstream Discount 1.2.10
  * support the `"nohtml"` option, to disable embedded html.
  * compile to use relaxed emphasis, meaning underscores don't count when
    they're in the middle of a word.
  * add some tests
  * include results of a simple benchmark in the readme
* lua-discount-1.2.7 (2008-08-03)
  * first public release

## See also
* [Discount](
* [Markdown syntax](
* [markdown.lua](

## Performance
Thanks to the underlying Discount implementation, lua-discount is incredibly
fast. Benchmarking markdown.lua 0.32 against lua-discount 1.2.10 by parsing
the [Markdown syntax
document]( 100 times
gives the following result (all figures are in seconds):

                       user     system      total       real
    lua-discount   0.170000   0.000000   0.170000   0.177374
    markdown.lua  48.530000   0.000000  48.530000  48.524910

## [Usage](id:usage)
Note that `require("discount")` returns a single function, which you are
responsible for giving a suitable name. Example:

    discount = require("discount")

    local markdown_string = [[
      # Demonstration
      This is a demonstration of lua-discount. Passing the options `"nolinks"`
      disables links such as [this](

      local html_string = discount(markdown_string, "nolinks")

The `discount` function takes as its first argument the Markdown string to
convert, and for its subsequent arguments takes any combination of the
following strings as options:

    do not allow `<a` or expand Markdown links.
    do not allow `<img` or expand Markdown images.
    disable [SmartyPants](
    disallow embedded html by replacing all `<` with `&lt;`.
    don't expand `*` or `_` when used for emphasis.
    do not process
    generate output suitable for use as data in an XML document.
= `"embed"`=
    equivalent to specifying `"nolinks"`, `"noimages"` and `"tagtext"`.

## License and acknowledgements
lua-discount is distributed under [a BSD-style

Thanks to Tim Channon for Windows support.

This product includes software developed by [David Loren

## Contact
Author: A.S. Bradbury
Email: <>
Homepage: <>