mirror of
https://github.com/jgm/pandoc.git
synced 2026-08-28 19:26:45 +00:00
Plain text readers are exposed to lua scripts via the `pandoc.reader`
submodule, which is further subdivided by format. Converting e.g. a
markdown string into a pandoc document is possible from within lua:
doc = pandoc.reader.markdown.read_doc("Hello, World!")
A `read_block` convenience function is provided for all formats,
although it will still parse the whole string but return only the first
block as the result.
Custom reader options are not supported yet, default options are used
for all parsing operations.
13 lines
235 B
Lua
13 lines
235 B
Lua
return {
|
|
{
|
|
RawBlock = function (blk)
|
|
local format, content = unpack(blk.c)
|
|
if format == "markdown" then
|
|
return pandoc.reader.markdown.read_block(content)
|
|
else
|
|
return blk
|
|
end
|
|
end,
|
|
}
|
|
}
|