lunamark.reader.markdown
new(writer, options)
Create a new markdown parser.
writer
is a writer table (see lunamark.writer.generic).options
is a table with parsing options. The following fields are significant:alter_syntax
-
Function from syntax table to syntax table, allowing the user to change or extend the markdown syntax. For an example, see the documentation for
lunamark
. references
-
A table of references to be used in resolving links in the document. The keys should be all lowercase, with spaces and newlines collapsed into single spaces. Example:
{ foo: { url = "/url", title = "my title" }, bar: { url = "http://fsf.org" } }
preserve_tabs
-
Preserve tabs instead of converting to spaces.
smart
-
Parse quotation marks, dashes, ellipses intelligently.
startnum
-
Make the opening number in an ordered list significant.
notes
-
Enable footnotes as in pandoc.
definition_lists
-
Enable definition lists as in pandoc.
pandoc_title_blocks
-
Parse pandoc-style title block at the beginning of document:
% Title % Author1; Author2 % Date
lua_metadata
-
Enable lua metadata. This is an HTML comment block that starts with
<!--@
and contains lua code. The lua code is interpreted in a sandbox, and any variables defined are added to the metadata. The functionmarkdown
(alsom
) is defined and can be used to ensure that string fields are parsed as markdown; otherwise, they will be read literally. require_blank_before_blockquote
-
Require a blank line between a paragraph and a following block quote.
require_blank_before_header
-
Require a blank line between a paragraph and a following header.
hash_enumerators
-
Allow
#
instead of a digit for an ordered list enumerator (equivalent to1
).
Returns a converter function that converts a markdown string using
writer
, returning the parsed document as first result, and a table containing any extracted metadata as the second result. The converter assumes that the input has unix line endings (newline). If the input might have DOS line endings, a simplegsub("\r","")
should take care of them.