torque 24810cbbbd
git subrepo clone --branch=0.30.3 https://github.com/commonmark/cmark.git deps/cmark
subrepo:
  subdir:   "deps/cmark"
  merged:   "5ba25ff"
upstream:
  origin:   "https://github.com/commonmark/cmark.git"
  branch:   "0.30.3"
  commit:   "5ba25ff"
git-subrepo:
  version:  "0.4.6"
  commit:   "d4444b563"
2023-09-04 15:42:46 -07:00

16 lines
316 B
Ruby
Executable File

#!/usr/bin/env ruby
require 'ffi'
module CMark
extend FFI::Library
ffi_lib ['libcmark', 'cmark']
attach_function :cmark_markdown_to_html, [:string, :int, :int], :string
end
def markdown_to_html(s)
len = s.bytesize
CMark::cmark_markdown_to_html(s, len, 0)
end
STDOUT.write(markdown_to_html(ARGF.read()))