This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
lunamark /
| name | age | message | |
|---|---|---|---|
| |
LICENSE | Fri Sep 11 07:20:49 -0700 2009 | |
| |
MarkdownTest_1.0.3/ | ||
| |
README.markdown | ||
| |
TODO | ||
| |
lunamark-0.1-1.rockspec | ||
| |
lunamark.lua | ||
| |
lunamark/ | ||
| |
markdown | ||
| |
runtests |
README.markdown
Lunamark
Lunamark is a lua library for conversion between markup formats. Currently markdown is the only supported input format, and HTML and LaTeX are the only supported output formats. But lunamark's modular architecture makes it easy to add new parsers and writers. Parsers are written using a PEG grammar.
Installing
Lunamark can be installed using luarocks:
git pull http://github.com/jgm/lunamark.git
cd lunamark
luarocks make
Using
lunamark.converter(in_format, out_format, options)
returns a function from string to string. in_format is currently
limited to markdown; out_format can be html or latex.
options is a table; currently the only supported option is
modify_syntax, a function from a grammar table to a grammar
table that can ring changes on the standard markdown syntax.
require "luarocks.require"
require "lunamark"
-- read stdin
inp = io.read("*a")
-- note: these are functions:
markdown2html = lunamark.converter("markdown", "html")
markdown2latex = lunamark.converter("markdown", "latex")
-- this one changes the syntax definition:
markdown2htmlCAPS = lunamark.converter("markdown", "html",
{ modify_syntax = function(t) t.Str = t.Str / string.upper; return t end })
io.write("HTML:\n",markdown2html(inp))
io.write("-----\n")
io.write("LaTeX:\n",markdown2latex(inp))
io.write("-----\n")
io.write("HTML CAPS:\n",markdown2htmlCAPS(inp))








