summaryrefslogtreecommitdiff
path: root/wrapper.rb
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2014-11-12 09:54:03 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2014-11-12 09:54:03 -0800
commit4127d33b392fbfc96a049e93ec4041ec8d59c15a (patch)
tree3443a63d433e31a22b226389e45d5a91ac066695 /wrapper.rb
parent3f47b0845432aa52d251613b07c065ce56730b84 (diff)
Added sample ruby wrapper.
Diffstat (limited to 'wrapper.rb')
-rw-r--r--wrapper.rb14
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());
+