File tree 1 file changed +8
-4
lines changed
1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change 2
2
extern crate mlua_derive;
3
3
4
4
use mlua:: prelude:: * ;
5
+ use pulldown_cmark:: { html, Options , Parser } ;
5
6
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)
9
13
}
10
14
11
15
#[ lua_module]
12
16
fn libvim_pandoc_syntax ( lua : & Lua ) -> LuaResult < LuaTable > {
13
17
let exports = lua. create_table ( ) ?;
14
- exports. set ( "hello " , lua. create_function ( hello ) ?) ?;
18
+ exports. set ( "render_html " , lua. create_function ( render_html ) ?) ?;
15
19
Ok ( exports)
16
20
}
17
21
You can’t perform that action at this time.
0 commit comments