Use the kramdown API, as @gettalong suggests