- Commit
- 4127d33b392fbfc96a049e93ec4041ec8d59c15a
- Parent
- 3f47b0845432aa52d251613b07c065ce56730b84
- Author
- John MacFarlane <jgm@berkeley.edu>
- Date
Added sample ruby wrapper.
My personal build of CMark ✏️
Added sample ruby wrapper.
1 file changed, 14 insertions, 0 deletions
Status | File Name | N° Changes | Insertions | Deletions |
Added | wrapper.rb | 14 | 14 | 0 |
diff --git a/wrapper.rb b/wrapper.rb @@ -0,0 +1,14 @@ +require 'ffi' + +module CMark + extend FFI::Library + ffi_lib ['libcmark', 'cmark'] + attach_function :cmark_markdown_to_html, [:string, :int], :string +end + +def markdown_to_html(s) + CMark::cmark_markdown_to_html(s, s.length) +end + +print markdown_to_html(STDIN.read()); +