Markdown processor for gopher-lua
go get github.com/kohkimakimoto/gluamarkdown
Returns HTML string generated from the markdown text.
Returns HTML string generated from the markdown text file. If this function fails, it returns nil
, plus a string describing the error.
package main
import (
"github.com/yuin/gopher-lua"
"github.com/kohkimakimoto/gluamarkdown"
)
func main() {
L := lua.NewState()
defer L.Close()
L.PreloadModule("markdown", gluamarkdown.Loader)
if err := L.DoString(`
local markdown = require("markdown")
local output = markdown.dostring([=[
# glua markdown
Markdown processor for gopher-lua
]=])
print(output)
-- you will get the following:
-- <h1>glua markdown</h1>
--
-- <p>Markdown processor for gopher-lua</p>
--
`); err != nil {
panic(err)
}
}
Kohki Makimoto kohki.makimoto@gmail.com
MIT license.