summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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());
+