aboutsummaryrefslogtreecommitdiff
path: root/wrapper.rb
blob: 3ec2186af475b8ec6927f9bcc16d94b18aea9662 (plain)
  1. require 'ffi'
  2. module CMark
  3. extend FFI::Library
  4. ffi_lib ['libcmark', 'cmark']
  5. attach_function :cmark_markdown_to_html, [:string, :int], :string
  6. end
  7. def markdown_to_html(s)
  8. CMark::cmark_markdown_to_html(s, s.length)
  9. end
  10. print markdown_to_html(STDIN.read());