summaryrefslogtreecommitdiff
path: root/wrapper.rb
blob: 3ec2186af475b8ec6927f9bcc16d94b18aea9662 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
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());