190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
# File 'ext/apex_ext/apex_ext.c', line 190
static VALUE
rb_apex_markdown_to_html(int argc, VALUE *argv, VALUE self)
{
VALUE text, opts_hash;
rb_scan_args(argc, argv, "11", &text, &opts_hash);
Check_Type(text, T_STRING);
if (NIL_P(opts_hash)) opts_hash = rb_hash_new();
const char *c_text = RSTRING_PTR(text);
size_t len = (size_t)RSTRING_LEN(text);
apex_options opts = options_from_hash(opts_hash);
char *out = apex_markdown_to_html(c_text, len, &opts);
if (!out) return Qnil;
VALUE rb_out = rb_utf8_str_new_cstr(out);
apex_free_string(out);
return rb_out;
}
|