diff options
author | John MacFarlane <jgm@berkeley.edu> | 2014-11-12 09:54:03 -0800 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2014-11-12 09:54:03 -0800 |
commit | 4127d33b392fbfc96a049e93ec4041ec8d59c15a (patch) | |
tree | 3443a63d433e31a22b226389e45d5a91ac066695 | |
parent | 3f47b0845432aa52d251613b07c065ce56730b84 (diff) |
Added sample ruby wrapper.
-rw-r--r-- | wrapper.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/wrapper.rb b/wrapper.rb new file mode 100644 index 0000000..3ec2186 --- /dev/null +++ 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()); + |