summaryrefslogtreecommitdiff
path: root/wrappers/wrapper.rb
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-01-12 20:28:17 -0800
committerJohn MacFarlane <jgm@berkeley.edu>2015-01-12 20:30:36 -0800
commit292b0bdad1aa79483a7498e72028bbff8134cebb (patch)
treeb7570099b327da3fab64cf77e92052d99416132a /wrappers/wrapper.rb
parent5ddf8743f02132f07aad4bb27e0b84c530a706d7 (diff)
Moved python, rb, lua wrappers to wrappers subdirectory.
Diffstat (limited to 'wrappers/wrapper.rb')
-rwxr-xr-xwrappers/wrapper.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/wrappers/wrapper.rb b/wrappers/wrapper.rb
new file mode 100755
index 0000000..59a9b87
--- /dev/null
+++ b/wrappers/wrapper.rb
@@ -0,0 +1,15 @@
+#!/usr/bin/env ruby
+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)
+ len = s.bytesize
+ CMark::cmark_markdown_to_html(s, len)
+end
+
+STDOUT.write(markdown_to_html(ARGF.read()))