blob: e7e515c0c76c51383febe0afe4ef8e680cae5607 (
plain)
- 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.bytes.length
- CMark::cmark_markdown_to_html(s, len)
- end
- print markdown_to_html(STDIN.read());
|