blob: 59a9b87560e5ea9eb7ab33e60ba0318c3a19a9f8 (
plain)
- #!/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()))
|