| 2 | require 'ffi' |
| 3 | |
| 4 | module CMark |
| 5 | extend FFI::Library |
| 6 | |
| 7 | class Mem < FFI::Struct |
| 8 | layout :calloc, :pointer, |
| 9 | :realloc, :pointer, |
| 10 | :free, callback([:pointer], :void) |
| 11 | end |
| 12 | |
| 13 | ffi_lib ['libcmark', 'cmark'] |
| 14 | attach_function :cmark_get_default_mem_allocator, [], :pointer |
| 15 | attach_function :cmark_markdown_to_html, [:string, :size_t, :int], :pointer |
| 16 | end |
| 17 | |
| 18 | def markdown_to_html(s) |
| 19 | len = s.bytesize |
nothing calls this directly
no outgoing calls
no test coverage detected