From 4127d33b392fbfc96a049e93ec4041ec8d59c15a Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Wed, 12 Nov 2014 09:54:03 -0800 Subject: Added sample ruby wrapper. --- wrapper.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 wrapper.rb 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()); + -- cgit v1.2.3