File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 22extern crate mlua_derive;
33
44use mlua:: prelude:: * ;
5+ use pulldown_cmark:: { html, Options , Parser } ;
56
6- fn hello ( _: & Lua , name : String ) -> LuaResult < String > {
7- let a: String = String :: from ( format ! ( "not you {} he he" , name) ) ;
8- Ok ( a)
7+ fn render_html ( _: & Lua , buffer : String ) -> LuaResult < String > {
8+ let options = Options :: all ( ) ;
9+ let parser = Parser :: new_ext ( buffer. as_str ( ) , options) ;
10+ let mut html_output = String :: new ( ) ;
11+ html:: push_html ( & mut html_output, parser) ;
12+ Ok ( html_output)
913}
1014
1115#[ lua_module]
1216fn libvim_pandoc_syntax ( lua : & Lua ) -> LuaResult < LuaTable > {
1317 let exports = lua. create_table ( ) ?;
14- exports. set ( "hello " , lua. create_function ( hello ) ?) ?;
18+ exports. set ( "render_html " , lua. create_function ( render_html ) ?) ?;
1519 Ok ( exports)
1620}
1721
You can’t perform that action at this time.
0 commit comments