aboutsummaryrefslogtreecommitdiff
path: root/wrapper.rb
blob: e7e515c0c76c51383febe0afe4ef8e680cae5607 (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. len = s.bytes.length
  9. CMark::cmark_markdown_to_html(s, len)
  10. end
  11. print markdown_to_html(STDIN.read());