markly 0.7.0 → 0.8.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. checksums.yaml.gz.sig +0 -0
  3. data/conduct.md +133 -0
  4. data/ext/markly/arena.c +9 -8
  5. data/ext/markly/autolink.c +217 -134
  6. data/ext/markly/blocks.c +27 -2
  7. data/ext/markly/cmark-gfm-core-extensions.h +11 -11
  8. data/ext/markly/cmark-gfm-extension_api.h +1 -0
  9. data/ext/markly/cmark-gfm.h +18 -2
  10. data/ext/markly/cmark.c +3 -3
  11. data/ext/markly/commonmark.c +19 -34
  12. data/ext/markly/extconf.rb +8 -1
  13. data/ext/markly/html.c +22 -6
  14. data/ext/markly/inlines.c +148 -51
  15. data/ext/markly/latex.c +6 -4
  16. data/ext/markly/man.c +7 -11
  17. data/ext/markly/map.c +11 -4
  18. data/ext/markly/map.h +5 -2
  19. data/ext/markly/markly.c +582 -586
  20. data/ext/markly/markly.h +1 -1
  21. data/ext/markly/node.c +76 -10
  22. data/ext/markly/node.h +42 -1
  23. data/ext/markly/parser.h +1 -0
  24. data/ext/markly/plaintext.c +12 -29
  25. data/ext/markly/references.c +1 -0
  26. data/ext/markly/render.c +15 -7
  27. data/ext/markly/scanners.c +13916 -10380
  28. data/ext/markly/scanners.h +8 -0
  29. data/ext/markly/scanners.re +47 -8
  30. data/ext/markly/strikethrough.c +1 -1
  31. data/ext/markly/table.c +81 -31
  32. data/ext/markly/xml.c +2 -1
  33. data/lib/markly/flags.rb +16 -0
  34. data/lib/markly/node/inspect.rb +59 -53
  35. data/lib/markly/node.rb +125 -58
  36. data/lib/markly/renderer/generic.rb +129 -124
  37. data/lib/markly/renderer/html.rb +294 -275
  38. data/lib/markly/version.rb +7 -1
  39. data/lib/markly.rb +36 -30
  40. data/license.md +39 -0
  41. data/readme.md +36 -0
  42. data.tar.gz.sig +0 -0
  43. metadata +61 -29
  44. metadata.gz.sig +0 -0
  45. data/bin/markly +0 -94
  46. data/lib/markly/markly.bundle +0 -0
data/ext/markly/markly.c CHANGED
@@ -207,60 +207,60 @@ static VALUE rb_Markly_Parser_parse(VALUE self, VALUE text) {
207
207
  * - `:image`
208
208
  */
209
209
  static VALUE rb_node_new(VALUE self, VALUE type) {
210
- cmark_node_type node_type = 0;
211
- cmark_node *node;
212
-
213
- Check_Type(type, T_SYMBOL);
214
-
215
- if (type == sym_document)
216
- node_type = CMARK_NODE_DOCUMENT;
217
- else if (type == sym_blockquote)
218
- node_type = CMARK_NODE_BLOCK_QUOTE;
219
- else if (type == sym_list)
220
- node_type = CMARK_NODE_LIST;
221
- else if (type == sym_list_item)
222
- node_type = CMARK_NODE_ITEM;
223
- else if (type == sym_code_block)
224
- node_type = CMARK_NODE_CODE_BLOCK;
225
- else if (type == sym_html)
226
- node_type = CMARK_NODE_HTML;
227
- else if (type == sym_paragraph)
228
- node_type = CMARK_NODE_PARAGRAPH;
229
- else if (type == sym_header)
230
- node_type = CMARK_NODE_HEADER;
231
- else if (type == sym_hrule)
232
- node_type = CMARK_NODE_HRULE;
233
- else if (type == sym_text)
234
- node_type = CMARK_NODE_TEXT;
235
- else if (type == sym_softbreak)
236
- node_type = CMARK_NODE_SOFTBREAK;
237
- else if (type == sym_linebreak)
238
- node_type = CMARK_NODE_LINEBREAK;
239
- else if (type == sym_code)
240
- node_type = CMARK_NODE_CODE;
241
- else if (type == sym_inline_html)
242
- node_type = CMARK_NODE_INLINE_HTML;
243
- else if (type == sym_emph)
244
- node_type = CMARK_NODE_EMPH;
245
- else if (type == sym_strong)
246
- node_type = CMARK_NODE_STRONG;
247
- else if (type == sym_link)
248
- node_type = CMARK_NODE_LINK;
249
- else if (type == sym_image)
250
- node_type = CMARK_NODE_IMAGE;
251
- else if (type == sym_footnote_reference)
252
- node_type = CMARK_NODE_FOOTNOTE_REFERENCE;
253
- else if (type == sym_footnote_definition)
254
- node_type = CMARK_NODE_FOOTNOTE_DEFINITION;
255
- else
256
- rb_raise(rb_Markly_Error, "invalid node of type %d", node_type);
257
-
258
- node = cmark_node_new(node_type);
259
- if (node == NULL) {
260
- rb_raise(rb_Markly_Error, "could not create node of type %d", node_type);
261
- }
262
-
263
- return rb_Markly_Node_wrap(node);
210
+ cmark_node_type node_type = 0;
211
+ cmark_node *node;
212
+
213
+ Check_Type(type, T_SYMBOL);
214
+
215
+ if (type == sym_document)
216
+ node_type = CMARK_NODE_DOCUMENT;
217
+ else if (type == sym_blockquote)
218
+ node_type = CMARK_NODE_BLOCK_QUOTE;
219
+ else if (type == sym_list)
220
+ node_type = CMARK_NODE_LIST;
221
+ else if (type == sym_list_item)
222
+ node_type = CMARK_NODE_ITEM;
223
+ else if (type == sym_code_block)
224
+ node_type = CMARK_NODE_CODE_BLOCK;
225
+ else if (type == sym_html)
226
+ node_type = CMARK_NODE_HTML;
227
+ else if (type == sym_paragraph)
228
+ node_type = CMARK_NODE_PARAGRAPH;
229
+ else if (type == sym_header)
230
+ node_type = CMARK_NODE_HEADER;
231
+ else if (type == sym_hrule)
232
+ node_type = CMARK_NODE_HRULE;
233
+ else if (type == sym_text)
234
+ node_type = CMARK_NODE_TEXT;
235
+ else if (type == sym_softbreak)
236
+ node_type = CMARK_NODE_SOFTBREAK;
237
+ else if (type == sym_linebreak)
238
+ node_type = CMARK_NODE_LINEBREAK;
239
+ else if (type == sym_code)
240
+ node_type = CMARK_NODE_CODE;
241
+ else if (type == sym_inline_html)
242
+ node_type = CMARK_NODE_INLINE_HTML;
243
+ else if (type == sym_emph)
244
+ node_type = CMARK_NODE_EMPH;
245
+ else if (type == sym_strong)
246
+ node_type = CMARK_NODE_STRONG;
247
+ else if (type == sym_link)
248
+ node_type = CMARK_NODE_LINK;
249
+ else if (type == sym_image)
250
+ node_type = CMARK_NODE_IMAGE;
251
+ else if (type == sym_footnote_reference)
252
+ node_type = CMARK_NODE_FOOTNOTE_REFERENCE;
253
+ else if (type == sym_footnote_definition)
254
+ node_type = CMARK_NODE_FOOTNOTE_DEFINITION;
255
+ else
256
+ rb_raise(rb_Markly_Error, "invalid node of type %d", node_type);
257
+
258
+ node = cmark_node_new(node_type);
259
+ if (node == NULL) {
260
+ rb_raise(rb_Markly_Error, "could not create node of type %d", node_type);
261
+ }
262
+
263
+ return rb_Markly_Node_wrap(node);
264
264
  }
265
265
 
266
266
  static VALUE rb_node_replace(VALUE self, VALUE other) {
@@ -279,10 +279,10 @@ static VALUE rb_node_replace(VALUE self, VALUE other) {
279
279
  }
280
280
 
281
281
  static VALUE encode_utf8_string(const char *c_string) {
282
- VALUE string = rb_str_new2(c_string);
283
- int enc = rb_enc_find_index("UTF-8");
284
- rb_enc_associate_index(string, enc);
285
- return string;
282
+ VALUE string = rb_str_new2(c_string);
283
+ int enc = rb_enc_find_index("UTF-8");
284
+ rb_enc_associate_index(string, enc);
285
+ return string;
286
286
  }
287
287
 
288
288
  /*
@@ -291,16 +291,16 @@ static VALUE encode_utf8_string(const char *c_string) {
291
291
  * Returns a {String}.
292
292
  */
293
293
  static VALUE rb_node_get_string_content(VALUE self) {
294
- const char *text;
295
- cmark_node *node;
296
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
294
+ const char *text;
295
+ cmark_node *node;
296
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
297
297
 
298
- text = cmark_node_get_literal(node);
299
- if (text == NULL) {
300
- rb_raise(rb_Markly_Error, "could not get string content");
301
- }
298
+ text = cmark_node_get_literal(node);
299
+ if (text == NULL) {
300
+ rb_raise(rb_Markly_Error, "could not get string content");
301
+ }
302
302
 
303
- return encode_utf8_string(text);
303
+ return encode_utf8_string(text);
304
304
  }
305
305
 
306
306
  /*
@@ -311,18 +311,18 @@ static VALUE rb_node_get_string_content(VALUE self) {
311
311
  * Raises Error if the string content can't be set.
312
312
  */
313
313
  static VALUE rb_node_set_string_content(VALUE self, VALUE s) {
314
- char *text;
315
- cmark_node *node;
316
- Check_Type(s, T_STRING);
314
+ char *text;
315
+ cmark_node *node;
316
+ Check_Type(s, T_STRING);
317
317
 
318
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
319
- text = StringValueCStr(s);
318
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
319
+ text = StringValueCStr(s);
320
320
 
321
- if (!cmark_node_set_literal(node, text)) {
322
- rb_raise(rb_Markly_Error, "could not set string content");
323
- }
321
+ if (!cmark_node_set_literal(node, text)) {
322
+ rb_raise(rb_Markly_Error, "could not set string content");
323
+ }
324
324
 
325
- return Qnil;
325
+ return Qnil;
326
326
  }
327
327
 
328
328
  /*
@@ -331,86 +331,86 @@ static VALUE rb_node_set_string_content(VALUE self, VALUE s) {
331
331
  * Returns a {Symbol} representing the node's type.
332
332
  */
333
333
  static VALUE rb_node_get_type(VALUE self) {
334
- int node_type = 0;
335
- cmark_node *node = NULL;
336
- VALUE symbol = Qnil;
337
- const char *s = NULL;
338
-
339
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
340
-
341
- node_type = cmark_node_get_type(node);
342
- symbol = Qnil;
343
-
344
- switch (node_type) {
345
- case CMARK_NODE_DOCUMENT:
346
- symbol = sym_document;
347
- break;
348
- case CMARK_NODE_BLOCK_QUOTE:
349
- symbol = sym_blockquote;
350
- break;
351
- case CMARK_NODE_LIST:
352
- symbol = sym_list;
353
- break;
354
- case CMARK_NODE_ITEM:
355
- symbol = sym_list_item;
356
- break;
357
- case CMARK_NODE_CODE_BLOCK:
358
- symbol = sym_code_block;
359
- break;
360
- case CMARK_NODE_HTML:
361
- symbol = sym_html;
362
- break;
363
- case CMARK_NODE_PARAGRAPH:
364
- symbol = sym_paragraph;
365
- break;
366
- case CMARK_NODE_HEADER:
367
- symbol = sym_header;
368
- break;
369
- case CMARK_NODE_HRULE:
370
- symbol = sym_hrule;
371
- break;
372
- case CMARK_NODE_TEXT:
373
- symbol = sym_text;
374
- break;
375
- case CMARK_NODE_SOFTBREAK:
376
- symbol = sym_softbreak;
377
- break;
378
- case CMARK_NODE_LINEBREAK:
379
- symbol = sym_linebreak;
380
- break;
381
- case CMARK_NODE_CODE:
382
- symbol = sym_code;
383
- break;
384
- case CMARK_NODE_INLINE_HTML:
385
- symbol = sym_inline_html;
386
- break;
387
- case CMARK_NODE_EMPH:
388
- symbol = sym_emph;
389
- break;
390
- case CMARK_NODE_STRONG:
391
- symbol = sym_strong;
392
- break;
393
- case CMARK_NODE_LINK:
394
- symbol = sym_link;
395
- break;
396
- case CMARK_NODE_IMAGE:
397
- symbol = sym_image;
398
- break;
399
- case CMARK_NODE_FOOTNOTE_REFERENCE:
400
- symbol = sym_footnote_reference;
401
- break;
402
- case CMARK_NODE_FOOTNOTE_DEFINITION:
403
- symbol = sym_footnote_definition;
404
- break;
405
- default:
406
- if (node->extension) {
407
- s = node->extension->get_type_string_func(node->extension, node);
408
- return ID2SYM(rb_intern(s));
409
- }
410
- rb_raise(rb_Markly_Error, "invalid node type %d", node_type);
411
- }
412
-
413
- return symbol;
334
+ int node_type = 0;
335
+ cmark_node *node = NULL;
336
+ VALUE symbol = Qnil;
337
+ const char *s = NULL;
338
+
339
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
340
+
341
+ node_type = cmark_node_get_type(node);
342
+ symbol = Qnil;
343
+
344
+ switch (node_type) {
345
+ case CMARK_NODE_DOCUMENT:
346
+ symbol = sym_document;
347
+ break;
348
+ case CMARK_NODE_BLOCK_QUOTE:
349
+ symbol = sym_blockquote;
350
+ break;
351
+ case CMARK_NODE_LIST:
352
+ symbol = sym_list;
353
+ break;
354
+ case CMARK_NODE_ITEM:
355
+ symbol = sym_list_item;
356
+ break;
357
+ case CMARK_NODE_CODE_BLOCK:
358
+ symbol = sym_code_block;
359
+ break;
360
+ case CMARK_NODE_HTML:
361
+ symbol = sym_html;
362
+ break;
363
+ case CMARK_NODE_PARAGRAPH:
364
+ symbol = sym_paragraph;
365
+ break;
366
+ case CMARK_NODE_HEADER:
367
+ symbol = sym_header;
368
+ break;
369
+ case CMARK_NODE_HRULE:
370
+ symbol = sym_hrule;
371
+ break;
372
+ case CMARK_NODE_TEXT:
373
+ symbol = sym_text;
374
+ break;
375
+ case CMARK_NODE_SOFTBREAK:
376
+ symbol = sym_softbreak;
377
+ break;
378
+ case CMARK_NODE_LINEBREAK:
379
+ symbol = sym_linebreak;
380
+ break;
381
+ case CMARK_NODE_CODE:
382
+ symbol = sym_code;
383
+ break;
384
+ case CMARK_NODE_INLINE_HTML:
385
+ symbol = sym_inline_html;
386
+ break;
387
+ case CMARK_NODE_EMPH:
388
+ symbol = sym_emph;
389
+ break;
390
+ case CMARK_NODE_STRONG:
391
+ symbol = sym_strong;
392
+ break;
393
+ case CMARK_NODE_LINK:
394
+ symbol = sym_link;
395
+ break;
396
+ case CMARK_NODE_IMAGE:
397
+ symbol = sym_image;
398
+ break;
399
+ case CMARK_NODE_FOOTNOTE_REFERENCE:
400
+ symbol = sym_footnote_reference;
401
+ break;
402
+ case CMARK_NODE_FOOTNOTE_DEFINITION:
403
+ symbol = sym_footnote_definition;
404
+ break;
405
+ default:
406
+ if (node->extension) {
407
+ s = node->extension->get_type_string_func(node->extension, node);
408
+ return ID2SYM(rb_intern(s));
409
+ }
410
+ rb_raise(rb_Markly_Error, "invalid node type %d", node_type);
411
+ }
412
+
413
+ return symbol;
414
414
  }
415
415
 
416
416
  /*
@@ -419,24 +419,24 @@ static VALUE rb_node_get_type(VALUE self) {
419
419
  * Returns a {Hash} containing {Symbol} keys of the positions.
420
420
  */
421
421
  static VALUE rb_node_get_source_position(VALUE self) {
422
- int start_line, start_column, end_line, end_column;
423
- VALUE result;
422
+ int start_line, start_column, end_line, end_column;
423
+ VALUE result;
424
424
 
425
- cmark_node *node;
426
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
425
+ cmark_node *node;
426
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
427
427
 
428
- start_line = cmark_node_get_start_line(node);
429
- start_column = cmark_node_get_start_column(node);
430
- end_line = cmark_node_get_end_line(node);
431
- end_column = cmark_node_get_end_column(node);
428
+ start_line = cmark_node_get_start_line(node);
429
+ start_column = cmark_node_get_start_column(node);
430
+ end_line = cmark_node_get_end_line(node);
431
+ end_column = cmark_node_get_end_column(node);
432
432
 
433
- result = rb_hash_new();
434
- rb_hash_aset(result, CSTR2SYM("start_line"), INT2NUM(start_line));
435
- rb_hash_aset(result, CSTR2SYM("start_column"), INT2NUM(start_column));
436
- rb_hash_aset(result, CSTR2SYM("end_line"), INT2NUM(end_line));
437
- rb_hash_aset(result, CSTR2SYM("end_column"), INT2NUM(end_column));
433
+ result = rb_hash_new();
434
+ rb_hash_aset(result, CSTR2SYM("start_line"), INT2NUM(start_line));
435
+ rb_hash_aset(result, CSTR2SYM("start_column"), INT2NUM(start_column));
436
+ rb_hash_aset(result, CSTR2SYM("end_line"), INT2NUM(end_line));
437
+ rb_hash_aset(result, CSTR2SYM("end_column"), INT2NUM(end_column));
438
438
 
439
- return result;
439
+ return result;
440
440
  }
441
441
 
442
442
  /*
@@ -445,10 +445,10 @@ static VALUE rb_node_get_source_position(VALUE self) {
445
445
  * Returns a {String}.
446
446
  */
447
447
  static VALUE rb_node_get_type_string(VALUE self) {
448
- cmark_node *node;
449
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
448
+ cmark_node *node;
449
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
450
450
 
451
- return rb_str_new2(cmark_node_get_type_string(node));
451
+ return rb_str_new2(cmark_node_get_type_string(node));
452
452
  }
453
453
 
454
454
  /*
@@ -456,12 +456,12 @@ static VALUE rb_node_get_type_string(VALUE self) {
456
456
  * parents and siblings appropriately).
457
457
  */
458
458
  static VALUE rb_node_unlink(VALUE self) {
459
- cmark_node *node;
460
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
459
+ cmark_node *node;
460
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
461
461
 
462
- cmark_node_unlink(node);
462
+ cmark_node_unlink(node);
463
463
 
464
- return Qnil;
464
+ return Qnil;
465
465
  }
466
466
 
467
467
  /* Public: Fetches the first child of the node.
@@ -469,12 +469,12 @@ static VALUE rb_node_unlink(VALUE self) {
469
469
  * Returns a {Node} if a child exists, `nil` otherise.
470
470
  */
471
471
  static VALUE rb_node_first_child(VALUE self) {
472
- cmark_node *node, *child;
473
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
472
+ cmark_node *node, *child;
473
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
474
474
 
475
- child = cmark_node_first_child(node);
475
+ child = cmark_node_first_child(node);
476
476
 
477
- return rb_Markly_Node_wrap(child);
477
+ return rb_Markly_Node_wrap(child);
478
478
  }
479
479
 
480
480
  /* Public: Fetches the next sibling of the node.
@@ -482,12 +482,12 @@ static VALUE rb_node_first_child(VALUE self) {
482
482
  * Returns a {Node} if a sibling exists, `nil` otherwise.
483
483
  */
484
484
  static VALUE rb_node_next(VALUE self) {
485
- cmark_node *node, *next;
486
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
485
+ cmark_node *node, *next;
486
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
487
487
 
488
- next = cmark_node_next(node);
488
+ next = cmark_node_next(node);
489
489
 
490
- return rb_Markly_Node_wrap(next);
490
+ return rb_Markly_Node_wrap(next);
491
491
  }
492
492
 
493
493
  /*
@@ -499,15 +499,15 @@ static VALUE rb_node_next(VALUE self) {
499
499
  * Raises Error if the node can't be inserted.
500
500
  */
501
501
  static VALUE rb_node_insert_before(VALUE self, VALUE sibling) {
502
- cmark_node *node1, *node2;
502
+ cmark_node *node1, *node2;
503
503
  TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node1);
504
504
  TypedData_Get_Struct(sibling, cmark_node, &rb_Markly_Node_Type, node2);
505
505
 
506
- if (!cmark_node_insert_before(node1, node2)) {
507
- rb_raise(rb_Markly_Error, "could not insert before");
508
- }
506
+ if (!cmark_node_insert_before(node1, node2)) {
507
+ rb_raise(rb_Markly_Error, "could not insert before");
508
+ }
509
509
 
510
- return Qtrue;
510
+ return Qtrue;
511
511
  }
512
512
 
513
513
  /* Internal: Convert the node to an HTML string.
@@ -515,46 +515,45 @@ static VALUE rb_node_insert_before(VALUE self, VALUE sibling) {
515
515
  * Returns a {String}.
516
516
  */
517
517
  static VALUE rb_render_html(VALUE self, VALUE rb_options, VALUE rb_extensions) {
518
- int options, extensions_len;
519
- VALUE rb_ext_name;
520
- int i;
521
- cmark_node *node;
522
- cmark_llist *extensions = NULL;
523
- cmark_mem *mem = cmark_get_default_mem_allocator();
524
- Check_Type(rb_options, T_FIXNUM);
525
- Check_Type(rb_extensions, T_ARRAY);
518
+ VALUE rb_ext_name;
519
+ int i;
520
+ cmark_node *node;
521
+ cmark_llist *extensions = NULL;
522
+ cmark_mem *mem = cmark_get_default_mem_allocator();
523
+ Check_Type(rb_options, T_FIXNUM);
524
+ Check_Type(rb_extensions, T_ARRAY);
526
525
 
527
- options = FIX2INT(rb_options);
528
- extensions_len = RARRAY_LEN(rb_extensions);
526
+ int options = FIX2INT(rb_options);
527
+ long extensions_len = RARRAY_LEN(rb_extensions);
529
528
 
530
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
529
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
531
530
 
532
- for (i = 0; i < extensions_len; ++i) {
533
- rb_ext_name = RARRAY_PTR(rb_extensions)[i];
531
+ for (i = 0; i < extensions_len; ++i) {
532
+ rb_ext_name = RARRAY_PTR(rb_extensions)[i];
534
533
 
535
- if (!SYMBOL_P(rb_ext_name)) {
536
- cmark_llist_free(mem, extensions);
537
- rb_raise(rb_eTypeError, "extension names should be Symbols; got a %"PRIsVALUE"", rb_obj_class(rb_ext_name));
538
- }
534
+ if (!SYMBOL_P(rb_ext_name)) {
535
+ cmark_llist_free(mem, extensions);
536
+ rb_raise(rb_eTypeError, "extension names should be Symbols; got a %"PRIsVALUE"", rb_obj_class(rb_ext_name));
537
+ }
539
538
 
540
- cmark_syntax_extension *syntax_extension =
541
- cmark_find_syntax_extension(rb_id2name(SYM2ID(rb_ext_name)));
539
+ cmark_syntax_extension *syntax_extension =
540
+ cmark_find_syntax_extension(rb_id2name(SYM2ID(rb_ext_name)));
542
541
 
543
- if (!syntax_extension) {
544
- cmark_llist_free(mem, extensions);
545
- rb_raise(rb_eArgError, "extension %s not found\n", rb_id2name(SYM2ID(rb_ext_name)));
546
- }
542
+ if (!syntax_extension) {
543
+ cmark_llist_free(mem, extensions);
544
+ rb_raise(rb_eArgError, "extension %s not found\n", rb_id2name(SYM2ID(rb_ext_name)));
545
+ }
547
546
 
548
- extensions = cmark_llist_append(mem, extensions, syntax_extension);
549
- }
547
+ extensions = cmark_llist_append(mem, extensions, syntax_extension);
548
+ }
550
549
 
551
- char *html = cmark_render_html(node, options, extensions);
552
- VALUE ruby_html = rb_str_new2(html);
550
+ char *html = cmark_render_html(node, options, extensions);
551
+ VALUE ruby_html = rb_str_new2(html);
553
552
 
554
- cmark_llist_free(mem, extensions);
555
- free(html);
553
+ cmark_llist_free(mem, extensions);
554
+ free(html);
556
555
 
557
- return ruby_html;
556
+ return ruby_html;
558
557
  }
559
558
 
560
559
  /* Internal: Convert the node to a CommonMark string.
@@ -562,27 +561,27 @@ static VALUE rb_render_html(VALUE self, VALUE rb_options, VALUE rb_extensions) {
562
561
  * Returns a {String}.
563
562
  */
564
563
  static VALUE rb_render_commonmark(int argc, VALUE *argv, VALUE self) {
565
- VALUE rb_options, rb_width;
566
- rb_scan_args(argc, argv, "11", &rb_options, &rb_width);
564
+ VALUE rb_options, rb_width;
565
+ rb_scan_args(argc, argv, "11", &rb_options, &rb_width);
567
566
 
568
- int width = 120;
569
- if (!NIL_P(rb_width)) {
570
- Check_Type(rb_width, T_FIXNUM);
571
- width = FIX2INT(rb_width);
572
- }
567
+ int width = 120;
568
+ if (!NIL_P(rb_width)) {
569
+ Check_Type(rb_width, T_FIXNUM);
570
+ width = FIX2INT(rb_width);
571
+ }
573
572
 
574
- int options;
575
- cmark_node *node;
576
- Check_Type(rb_options, T_FIXNUM);
573
+ int options;
574
+ cmark_node *node;
575
+ Check_Type(rb_options, T_FIXNUM);
577
576
 
578
- options = FIX2INT(rb_options);
579
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
577
+ options = FIX2INT(rb_options);
578
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
580
579
 
581
- char *cmark = cmark_render_commonmark(node, options, width);
582
- VALUE ruby_cmark = rb_str_new2(cmark);
583
- free(cmark);
580
+ char *cmark = cmark_render_commonmark(node, options, width);
581
+ VALUE ruby_cmark = rb_str_new2(cmark);
582
+ free(cmark);
584
583
 
585
- return ruby_cmark;
584
+ return ruby_cmark;
586
585
  }
587
586
 
588
587
  /* Internal: Convert the node to a plain textstring.
@@ -590,27 +589,27 @@ static VALUE rb_render_commonmark(int argc, VALUE *argv, VALUE self) {
590
589
  * Returns a {String}.
591
590
  */
592
591
  static VALUE rb_render_plaintext(int argc, VALUE *argv, VALUE self) {
593
- VALUE rb_options, rb_width;
594
- rb_scan_args(argc, argv, "11", &rb_options, &rb_width);
592
+ VALUE rb_options, rb_width;
593
+ rb_scan_args(argc, argv, "11", &rb_options, &rb_width);
595
594
 
596
- int width = 120;
597
- if (!NIL_P(rb_width)) {
598
- Check_Type(rb_width, T_FIXNUM);
599
- width = FIX2INT(rb_width);
600
- }
595
+ int width = 120;
596
+ if (!NIL_P(rb_width)) {
597
+ Check_Type(rb_width, T_FIXNUM);
598
+ width = FIX2INT(rb_width);
599
+ }
601
600
 
602
- int options;
603
- cmark_node *node;
604
- Check_Type(rb_options, T_FIXNUM);
601
+ int options;
602
+ cmark_node *node;
603
+ Check_Type(rb_options, T_FIXNUM);
605
604
 
606
- options = FIX2INT(rb_options);
607
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
605
+ options = FIX2INT(rb_options);
606
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
608
607
 
609
- char *text = cmark_render_plaintext(node, options, width);
610
- VALUE ruby_text = rb_str_new2(text);
611
- free(text);
608
+ char *text = cmark_render_plaintext(node, options, width);
609
+ VALUE ruby_text = rb_str_new2(text);
610
+ free(text);
612
611
 
613
- return ruby_text;
612
+ return ruby_text;
614
613
  }
615
614
 
616
615
  /*
@@ -622,15 +621,15 @@ static VALUE rb_render_plaintext(int argc, VALUE *argv, VALUE self) {
622
621
  * Raises Error if the node can't be inserted.
623
622
  */
624
623
  static VALUE rb_node_insert_after(VALUE self, VALUE sibling) {
625
- cmark_node *node1, *node2;
624
+ cmark_node *node1, *node2;
626
625
  TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node1);
627
626
  TypedData_Get_Struct(sibling, cmark_node, &rb_Markly_Node_Type, node2);
628
627
 
629
- if (!cmark_node_insert_after(node1, node2)) {
630
- rb_raise(rb_Markly_Error, "could not insert after");
631
- }
628
+ if (!cmark_node_insert_after(node1, node2)) {
629
+ rb_raise(rb_Markly_Error, "could not insert after");
630
+ }
632
631
 
633
- return Qtrue;
632
+ return Qtrue;
634
633
  }
635
634
 
636
635
  /*
@@ -642,15 +641,15 @@ static VALUE rb_node_insert_after(VALUE self, VALUE sibling) {
642
641
  * Raises Error if the node can't be inserted.
643
642
  */
644
643
  static VALUE rb_node_prepend_child(VALUE self, VALUE child) {
645
- cmark_node *node1, *node2;
644
+ cmark_node *node1, *node2;
646
645
  TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node1);
647
646
  TypedData_Get_Struct(child, cmark_node, &rb_Markly_Node_Type, node2);
648
647
 
649
- if (!cmark_node_prepend_child(node1, node2)) {
650
- rb_raise(rb_Markly_Error, "could not prepend child");
651
- }
648
+ if (!cmark_node_prepend_child(node1, node2)) {
649
+ rb_raise(rb_Markly_Error, "could not prepend child");
650
+ }
652
651
 
653
- return Qtrue;
652
+ return Qtrue;
654
653
  }
655
654
 
656
655
  /*
@@ -662,15 +661,15 @@ static VALUE rb_node_prepend_child(VALUE self, VALUE child) {
662
661
  * Raises Error if the node can't be inserted.
663
662
  */
664
663
  static VALUE rb_node_append_child(VALUE self, VALUE child) {
665
- cmark_node *node1, *node2;
664
+ cmark_node *node1, *node2;
666
665
  TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node1);
667
666
  TypedData_Get_Struct(child, cmark_node, &rb_Markly_Node_Type, node2);
668
667
 
669
- if (!cmark_node_append_child(node1, node2)) {
670
- rb_raise(rb_Markly_Error, "could not append child");
671
- }
668
+ if (!cmark_node_append_child(node1, node2)) {
669
+ rb_raise(rb_Markly_Error, "could not append child");
670
+ }
672
671
 
673
- return Qtrue;
672
+ return Qtrue;
674
673
  }
675
674
 
676
675
  /* Public: Fetches the first child of the current node.
@@ -678,12 +677,12 @@ static VALUE rb_node_append_child(VALUE self, VALUE child) {
678
677
  * Returns a {Node} if a child exists, `nil` otherise.
679
678
  */
680
679
  static VALUE rb_node_last_child(VALUE self) {
681
- cmark_node *node, *child;
682
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
680
+ cmark_node *node, *child;
681
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
683
682
 
684
- child = cmark_node_last_child(node);
683
+ child = cmark_node_last_child(node);
685
684
 
686
- return rb_Markly_Node_wrap(child);
685
+ return rb_Markly_Node_wrap(child);
687
686
  }
688
687
 
689
688
  /* Public: Fetches the parent of the current node.
@@ -691,12 +690,12 @@ static VALUE rb_node_last_child(VALUE self) {
691
690
  * Returns a {Node} if a parent exists, `nil` otherise.
692
691
  */
693
692
  static VALUE rb_node_parent(VALUE self) {
694
- cmark_node *node, *parent;
695
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
693
+ cmark_node *node, *parent;
694
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
696
695
 
697
- parent = cmark_node_parent(node);
696
+ parent = cmark_node_parent(node);
698
697
 
699
- return rb_Markly_Node_wrap(parent);
698
+ return rb_Markly_Node_wrap(parent);
700
699
  }
701
700
 
702
701
  /* Public: Fetches the previous sibling of the current node.
@@ -704,12 +703,12 @@ static VALUE rb_node_parent(VALUE self) {
704
703
  * Returns a {Node} if a parent exists, `nil` otherise.
705
704
  */
706
705
  static VALUE rb_node_previous(VALUE self) {
707
- cmark_node *node, *previous;
708
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
706
+ cmark_node *node, *previous;
707
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
709
708
 
710
- previous = cmark_node_previous(node);
709
+ previous = cmark_node_previous(node);
711
710
 
712
- return rb_Markly_Node_wrap(previous);
711
+ return rb_Markly_Node_wrap(previous);
713
712
  }
714
713
 
715
714
  /*
@@ -719,16 +718,16 @@ static VALUE rb_node_previous(VALUE self) {
719
718
  * Raises a Error if the URL can't be retrieved.
720
719
  */
721
720
  static VALUE rb_node_get_url(VALUE self) {
722
- const char *text;
723
- cmark_node *node;
724
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
721
+ const char *text;
722
+ cmark_node *node;
723
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
725
724
 
726
- text = cmark_node_get_url(node);
727
- if (text == NULL) {
728
- rb_raise(rb_Markly_Error, "could not get url");
729
- }
725
+ text = cmark_node_get_url(node);
726
+ if (text == NULL) {
727
+ rb_raise(rb_Markly_Error, "could not get url");
728
+ }
730
729
 
731
- return rb_str_new2(text);
730
+ return rb_str_new2(text);
732
731
  }
733
732
 
734
733
  /*
@@ -739,18 +738,18 @@ static VALUE rb_node_get_url(VALUE self) {
739
738
  * Raises a Error if the URL can't be set.
740
739
  */
741
740
  static VALUE rb_node_set_url(VALUE self, VALUE url) {
742
- cmark_node *node;
743
- char *text;
744
- Check_Type(url, T_STRING);
741
+ cmark_node *node;
742
+ char *text;
743
+ Check_Type(url, T_STRING);
745
744
 
746
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
747
- text = StringValueCStr(url);
745
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
746
+ text = StringValueCStr(url);
748
747
 
749
- if (!cmark_node_set_url(node, text)) {
750
- rb_raise(rb_Markly_Error, "could not set url");
751
- }
748
+ if (!cmark_node_set_url(node, text)) {
749
+ rb_raise(rb_Markly_Error, "could not set url");
750
+ }
752
751
 
753
- return Qnil;
752
+ return Qnil;
754
753
  }
755
754
 
756
755
  /*
@@ -760,16 +759,16 @@ static VALUE rb_node_set_url(VALUE self, VALUE url) {
760
759
  * Raises a Error if the title can't be retrieved.
761
760
  */
762
761
  static VALUE rb_node_get_title(VALUE self) {
763
- const char *text;
764
- cmark_node *node;
765
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
762
+ const char *text;
763
+ cmark_node *node;
764
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
766
765
 
767
- text = cmark_node_get_title(node);
768
- if (text == NULL) {
769
- rb_raise(rb_Markly_Error, "could not get title");
770
- }
766
+ text = cmark_node_get_title(node);
767
+ if (text == NULL) {
768
+ rb_raise(rb_Markly_Error, "could not get title");
769
+ }
771
770
 
772
- return rb_str_new2(text);
771
+ return rb_str_new2(text);
773
772
  }
774
773
 
775
774
  /*
@@ -780,18 +779,18 @@ static VALUE rb_node_get_title(VALUE self) {
780
779
  * Raises a Error if the title can't be set.
781
780
  */
782
781
  static VALUE rb_node_set_title(VALUE self, VALUE title) {
783
- char *text;
784
- cmark_node *node;
785
- Check_Type(title, T_STRING);
782
+ char *text;
783
+ cmark_node *node;
784
+ Check_Type(title, T_STRING);
786
785
 
787
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
788
- text = StringValueCStr(title);
786
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
787
+ text = StringValueCStr(title);
789
788
 
790
- if (!cmark_node_set_title(node, text)) {
791
- rb_raise(rb_Markly_Error, "could not set title");
792
- }
789
+ if (!cmark_node_set_title(node, text)) {
790
+ rb_raise(rb_Markly_Error, "could not set title");
791
+ }
793
792
 
794
- return Qnil;
793
+ return Qnil;
795
794
  }
796
795
 
797
796
  /*
@@ -801,17 +800,17 @@ static VALUE rb_node_set_title(VALUE self, VALUE title) {
801
800
  * Raises a Error if the header level can't be retrieved.
802
801
  */
803
802
  static VALUE rb_node_get_header_level(VALUE self) {
804
- int header_level;
805
- cmark_node *node;
806
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
803
+ int header_level;
804
+ cmark_node *node;
805
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
807
806
 
808
- header_level = cmark_node_get_header_level(node);
807
+ header_level = cmark_node_get_header_level(node);
809
808
 
810
- if (header_level == 0) {
811
- rb_raise(rb_Markly_Error, "could not get header_level");
812
- }
809
+ if (header_level == 0) {
810
+ rb_raise(rb_Markly_Error, "could not get header_level");
811
+ }
813
812
 
814
- return INT2NUM(header_level);
813
+ return INT2NUM(header_level);
815
814
  }
816
815
 
817
816
  /*
@@ -822,18 +821,18 @@ static VALUE rb_node_get_header_level(VALUE self) {
822
821
  * Raises a Error if the header level can't be set.
823
822
  */
824
823
  static VALUE rb_node_set_header_level(VALUE self, VALUE level) {
825
- int l;
826
- cmark_node *node;
827
- Check_Type(level, T_FIXNUM);
824
+ int l;
825
+ cmark_node *node;
826
+ Check_Type(level, T_FIXNUM);
828
827
 
829
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
830
- l = FIX2INT(level);
828
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
829
+ l = FIX2INT(level);
831
830
 
832
- if (!cmark_node_set_header_level(node, l)) {
833
- rb_raise(rb_Markly_Error, "could not set header_level");
834
- }
831
+ if (!cmark_node_set_header_level(node, l)) {
832
+ rb_raise(rb_Markly_Error, "could not set header_level");
833
+ }
835
834
 
836
- return Qnil;
835
+ return Qnil;
837
836
  }
838
837
 
839
838
  /*
@@ -843,22 +842,22 @@ static VALUE rb_node_set_header_level(VALUE self, VALUE level) {
843
842
  * Raises a Error if the title can't be retrieved.
844
843
  */
845
844
  static VALUE rb_node_get_list_type(VALUE self) {
846
- int list_type;
847
- cmark_node *node;
848
- VALUE symbol;
849
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
850
-
851
- list_type = cmark_node_get_list_type(node);
852
-
853
- if (list_type == CMARK_BULLET_LIST) {
854
- symbol = sym_bullet_list;
855
- } else if (list_type == CMARK_ORDERED_LIST) {
856
- symbol = sym_ordered_list;
857
- } else {
858
- rb_raise(rb_Markly_Error, "could not get list_type");
859
- }
860
-
861
- return symbol;
845
+ int list_type;
846
+ cmark_node *node;
847
+ VALUE symbol;
848
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
849
+
850
+ list_type = cmark_node_get_list_type(node);
851
+
852
+ if (list_type == CMARK_BULLET_LIST) {
853
+ symbol = sym_bullet_list;
854
+ } else if (list_type == CMARK_ORDERED_LIST) {
855
+ symbol = sym_ordered_list;
856
+ } else {
857
+ rb_raise(rb_Markly_Error, "could not get list_type");
858
+ }
859
+
860
+ return symbol;
862
861
  }
863
862
 
864
863
  /*
@@ -869,25 +868,25 @@ static VALUE rb_node_get_list_type(VALUE self) {
869
868
  * Raises a Error if the list type can't be set.
870
869
  */
871
870
  static VALUE rb_node_set_list_type(VALUE self, VALUE list_type) {
872
- int type = 0;
873
- cmark_node *node;
874
- Check_Type(list_type, T_SYMBOL);
875
-
876
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
877
-
878
- if (list_type == sym_bullet_list) {
879
- type = CMARK_BULLET_LIST;
880
- } else if (list_type == sym_ordered_list) {
881
- type = CMARK_ORDERED_LIST;
882
- } else {
883
- rb_raise(rb_Markly_Error, "invalid list_type");
884
- }
871
+ int type = 0;
872
+ cmark_node *node;
873
+ Check_Type(list_type, T_SYMBOL);
874
+
875
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
876
+
877
+ if (list_type == sym_bullet_list) {
878
+ type = CMARK_BULLET_LIST;
879
+ } else if (list_type == sym_ordered_list) {
880
+ type = CMARK_ORDERED_LIST;
881
+ } else {
882
+ rb_raise(rb_Markly_Error, "invalid list_type");
883
+ }
885
884
 
886
- if (!cmark_node_set_list_type(node, type)) {
887
- rb_raise(rb_Markly_Error, "could not set list_type");
888
- }
885
+ if (!cmark_node_set_list_type(node, type)) {
886
+ rb_raise(rb_Markly_Error, "could not set list_type");
887
+ }
889
888
 
890
- return Qnil;
889
+ return Qnil;
891
890
  }
892
891
 
893
892
  /*
@@ -898,16 +897,16 @@ static VALUE rb_node_set_list_type(VALUE self, VALUE list_type) {
898
897
  * Raises a Error if the starting number can't be retrieved.
899
898
  */
900
899
  static VALUE rb_node_get_list_start(VALUE self) {
901
- cmark_node *node;
902
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
900
+ cmark_node *node;
901
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
903
902
 
904
- if (cmark_node_get_type(node) != CMARK_NODE_LIST ||
905
- cmark_node_get_list_type(node) != CMARK_ORDERED_LIST) {
906
- rb_raise(rb_Markly_Error, "can't get list_start for non-ordered list %d",
907
- cmark_node_get_list_type(node));
908
- }
903
+ if (cmark_node_get_type(node) != CMARK_NODE_LIST ||
904
+ cmark_node_get_list_type(node) != CMARK_ORDERED_LIST) {
905
+ rb_raise(rb_Markly_Error, "can't get list_start for non-ordered list %d",
906
+ cmark_node_get_list_type(node));
907
+ }
909
908
 
910
- return INT2NUM(cmark_node_get_list_start(node));
909
+ return INT2NUM(cmark_node_get_list_start(node));
911
910
  }
912
911
 
913
912
  /*
@@ -919,18 +918,18 @@ static VALUE rb_node_get_list_start(VALUE self) {
919
918
  * Raises a Error if the starting number can't be set.
920
919
  */
921
920
  static VALUE rb_node_set_list_start(VALUE self, VALUE start) {
922
- int s;
923
- cmark_node *node;
924
- Check_Type(start, T_FIXNUM);
921
+ int s;
922
+ cmark_node *node;
923
+ Check_Type(start, T_FIXNUM);
925
924
 
926
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
927
- s = FIX2INT(start);
925
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
926
+ s = FIX2INT(start);
928
927
 
929
- if (!cmark_node_set_list_start(node, s)) {
930
- rb_raise(rb_Markly_Error, "could not set list_start");
931
- }
928
+ if (!cmark_node_set_list_start(node, s)) {
929
+ rb_raise(rb_Markly_Error, "could not set list_start");
930
+ }
932
931
 
933
- return Qnil;
932
+ return Qnil;
934
933
  }
935
934
 
936
935
  /*
@@ -940,17 +939,17 @@ static VALUE rb_node_set_list_start(VALUE self, VALUE start) {
940
939
  * Raises a Error if the starting number can't be retrieved.
941
940
  */
942
941
  static VALUE rb_node_get_list_tight(VALUE self) {
943
- int flag;
944
- cmark_node *node;
945
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
942
+ int flag;
943
+ cmark_node *node;
944
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
946
945
 
947
- if (cmark_node_get_type(node) != CMARK_NODE_LIST) {
948
- rb_raise(rb_Markly_Error, "can't get list_tight for non-list");
949
- }
946
+ if (cmark_node_get_type(node) != CMARK_NODE_LIST) {
947
+ rb_raise(rb_Markly_Error, "can't get list_tight for non-list");
948
+ }
950
949
 
951
- flag = cmark_node_get_list_tight(node);
950
+ flag = cmark_node_get_list_tight(node);
952
951
 
953
- return flag ? Qtrue : Qfalse;
952
+ return flag ? Qtrue : Qfalse;
954
953
  }
955
954
 
956
955
  /*
@@ -961,16 +960,16 @@ static VALUE rb_node_get_list_tight(VALUE self) {
961
960
  * Raises a Error if the tightness can't be set.
962
961
  */
963
962
  static VALUE rb_node_set_list_tight(VALUE self, VALUE tight) {
964
- int t;
965
- cmark_node *node;
966
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
967
- t = RTEST(tight);
963
+ int t;
964
+ cmark_node *node;
965
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
966
+ t = RTEST(tight);
968
967
 
969
- if (!cmark_node_set_list_tight(node, t)) {
970
- rb_raise(rb_Markly_Error, "could not set list_tight");
971
- }
968
+ if (!cmark_node_set_list_tight(node, t)) {
969
+ rb_raise(rb_Markly_Error, "could not set list_tight");
970
+ }
972
971
 
973
- return Qnil;
972
+ return Qnil;
974
973
  }
975
974
 
976
975
  /*
@@ -980,17 +979,17 @@ static VALUE rb_node_set_list_tight(VALUE self, VALUE tight) {
980
979
  * Raises a Error if the fence info can't be retrieved.
981
980
  */
982
981
  static VALUE rb_node_get_fence_info(VALUE self) {
983
- const char *fence_info;
984
- cmark_node *node;
985
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
982
+ const char *fence_info;
983
+ cmark_node *node;
984
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
986
985
 
987
- fence_info = cmark_node_get_fence_info(node);
986
+ fence_info = cmark_node_get_fence_info(node);
988
987
 
989
- if (fence_info == NULL) {
990
- rb_raise(rb_Markly_Error, "could not get fence_info");
991
- }
988
+ if (fence_info == NULL) {
989
+ rb_raise(rb_Markly_Error, "could not get fence_info");
990
+ }
992
991
 
993
- return rb_str_new2(fence_info);
992
+ return rb_str_new2(fence_info);
994
993
  }
995
994
 
996
995
  /*
@@ -1001,32 +1000,32 @@ static VALUE rb_node_get_fence_info(VALUE self) {
1001
1000
  * Raises a Error if the fence info can't be set.
1002
1001
  */
1003
1002
  static VALUE rb_node_set_fence_info(VALUE self, VALUE info) {
1004
- char *text;
1005
- cmark_node *node;
1006
- Check_Type(info, T_STRING);
1003
+ char *text;
1004
+ cmark_node *node;
1005
+ Check_Type(info, T_STRING);
1007
1006
 
1008
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1009
- text = StringValueCStr(info);
1007
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1008
+ text = StringValueCStr(info);
1010
1009
 
1011
- if (!cmark_node_set_fence_info(node, text)) {
1012
- rb_raise(rb_Markly_Error, "could not set fence_info");
1013
- }
1010
+ if (!cmark_node_set_fence_info(node, text)) {
1011
+ rb_raise(rb_Markly_Error, "could not set fence_info");
1012
+ }
1014
1013
 
1015
- return Qnil;
1014
+ return Qnil;
1016
1015
  }
1017
1016
 
1018
1017
  static VALUE rb_node_get_tasklist_item_checked(VALUE self) {
1019
- int tasklist_state;
1020
- cmark_node *node;
1021
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1018
+ int tasklist_state;
1019
+ cmark_node *node;
1020
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1022
1021
 
1023
- tasklist_state = cmark_gfm_extensions_get_tasklist_item_checked(node);
1022
+ tasklist_state = cmark_gfm_extensions_get_tasklist_item_checked(node);
1024
1023
 
1025
- if (tasklist_state == 1) {
1026
- return Qtrue;
1027
- } else {
1028
- return Qfalse;
1029
- }
1024
+ if (tasklist_state == 1) {
1025
+ return Qtrue;
1026
+ } else {
1027
+ return Qfalse;
1028
+ }
1030
1029
  }
1031
1030
 
1032
1031
  /*
@@ -1038,207 +1037,204 @@ static VALUE rb_node_get_tasklist_item_checked(VALUE self) {
1038
1037
  * Raises a Error if the checkbox state can't be set.
1039
1038
  */
1040
1039
  static VALUE rb_node_set_tasklist_item_checked(VALUE self, VALUE item_checked) {
1041
- int tasklist_state;
1042
- cmark_node *node;
1043
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1044
- tasklist_state = RTEST(item_checked);
1045
-
1046
- if (!cmark_gfm_extensions_set_tasklist_item_checked(node, tasklist_state)) {
1047
- rb_raise(rb_Markly_Error, "could not set tasklist_item_checked");
1048
- };
1049
-
1050
- if (tasklist_state) {
1051
- return Qtrue;
1052
- } else {
1053
- return Qfalse;
1054
- }
1040
+ int tasklist_state;
1041
+ cmark_node *node;
1042
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1043
+ tasklist_state = RTEST(item_checked);
1044
+
1045
+ if (!cmark_gfm_extensions_set_tasklist_item_checked(node, tasklist_state)) {
1046
+ rb_raise(rb_Markly_Error, "could not set tasklist_item_checked");
1047
+ };
1048
+
1049
+ if (tasklist_state) {
1050
+ return Qtrue;
1051
+ } else {
1052
+ return Qfalse;
1053
+ }
1055
1054
  }
1056
1055
 
1057
- // TODO: remove this, superseded by the above method
1058
- static VALUE rb_node_get_tasklist_state(VALUE self) {
1059
- int tasklist_state;
1060
- cmark_node *node;
1061
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1056
+ static VALUE rb_node_get_parent_footnote_def(VALUE self) {
1057
+ cmark_node *node;
1058
+ cmark_node *parent;
1059
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1062
1060
 
1063
- tasklist_state = cmark_gfm_extensions_get_tasklist_item_checked(node);
1061
+ parent = cmark_node_parent_footnote_def(node);
1064
1062
 
1065
- if (tasklist_state == 1) {
1066
- return rb_str_new2("checked");
1067
- } else {
1068
- return rb_str_new2("unchecked");
1069
- }
1063
+ return rb_Markly_Node_wrap(parent);
1070
1064
  }
1071
1065
 
1072
1066
  static VALUE rb_node_get_table_alignments(VALUE self) {
1073
- uint16_t column_count, i;
1074
- uint8_t *alignments;
1075
- cmark_node *node;
1076
- VALUE ary;
1077
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1078
-
1079
- column_count = cmark_gfm_extensions_get_table_columns(node);
1080
- alignments = cmark_gfm_extensions_get_table_alignments(node);
1081
-
1082
- if (!column_count || !alignments) {
1083
- rb_raise(rb_Markly_Error, "could not get column_count or alignments");
1084
- }
1085
-
1086
- ary = rb_ary_new();
1087
- for (i = 0; i < column_count; ++i) {
1088
- if (alignments[i] == 'l')
1089
- rb_ary_push(ary, sym_left);
1090
- else if (alignments[i] == 'c')
1091
- rb_ary_push(ary, sym_center);
1092
- else if (alignments[i] == 'r')
1093
- rb_ary_push(ary, sym_right);
1094
- else
1095
- rb_ary_push(ary, Qnil);
1096
- }
1097
- return ary;
1067
+ uint16_t column_count, i;
1068
+ uint8_t *alignments;
1069
+ cmark_node *node;
1070
+ VALUE ary;
1071
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1072
+
1073
+ column_count = cmark_gfm_extensions_get_table_columns(node);
1074
+ alignments = cmark_gfm_extensions_get_table_alignments(node);
1075
+
1076
+ if (!column_count || !alignments) {
1077
+ rb_raise(rb_Markly_Error, "could not get column_count or alignments");
1078
+ }
1079
+
1080
+ ary = rb_ary_new();
1081
+ for (i = 0; i < column_count; ++i) {
1082
+ if (alignments[i] == 'l')
1083
+ rb_ary_push(ary, sym_left);
1084
+ else if (alignments[i] == 'c')
1085
+ rb_ary_push(ary, sym_center);
1086
+ else if (alignments[i] == 'r')
1087
+ rb_ary_push(ary, sym_right);
1088
+ else
1089
+ rb_ary_push(ary, Qnil);
1090
+ }
1091
+ return ary;
1098
1092
  }
1099
1093
 
1100
1094
  /* Internal: Escapes href URLs safely. */
1101
1095
  static VALUE rb_html_escape_href(VALUE self, VALUE rb_text) {
1102
- char *result;
1103
- cmark_node *node;
1104
- Check_Type(rb_text, T_STRING);
1096
+ char *result;
1097
+ cmark_node *node;
1098
+ Check_Type(rb_text, T_STRING);
1105
1099
 
1106
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1100
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1107
1101
 
1108
- cmark_mem *mem = cmark_node_mem(node);
1109
- cmark_strbuf buf = CMARK_BUF_INIT(mem);
1102
+ cmark_mem *mem = cmark_node_mem(node);
1103
+ cmark_strbuf buf = CMARK_BUF_INIT(mem);
1110
1104
 
1111
- if (houdini_escape_href(&buf, (const uint8_t *)RSTRING_PTR(rb_text),
1112
- RSTRING_LEN(rb_text))) {
1113
- result = (char *)cmark_strbuf_detach(&buf);
1114
- return rb_str_new2(result);
1115
- }
1105
+ if (houdini_escape_href(&buf, (const uint8_t *)RSTRING_PTR(rb_text),
1106
+ RSTRING_LEN(rb_text))) {
1107
+ result = (char *)cmark_strbuf_detach(&buf);
1108
+ return rb_str_new2(result);
1109
+ }
1116
1110
 
1117
- return rb_text;
1111
+ return rb_text;
1118
1112
  }
1119
1113
 
1120
1114
  /* Internal: Escapes HTML content safely. */
1121
1115
  static VALUE rb_html_escape_html(VALUE self, VALUE rb_text) {
1122
- char *result;
1123
- cmark_node *node;
1124
- Check_Type(rb_text, T_STRING);
1116
+ char *result;
1117
+ cmark_node *node;
1118
+ Check_Type(rb_text, T_STRING);
1125
1119
 
1126
- TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1120
+ TypedData_Get_Struct(self, cmark_node, &rb_Markly_Node_Type, node);
1127
1121
 
1128
- cmark_mem *mem = cmark_node_mem(node);
1129
- cmark_strbuf buf = CMARK_BUF_INIT(mem);
1122
+ cmark_mem *mem = cmark_node_mem(node);
1123
+ cmark_strbuf buf = CMARK_BUF_INIT(mem);
1130
1124
 
1131
- if (houdini_escape_html0(&buf, (const uint8_t *)RSTRING_PTR(rb_text),
1132
- RSTRING_LEN(rb_text), 0)) {
1133
- result = (char *)cmark_strbuf_detach(&buf);
1134
- return rb_str_new2(result);
1135
- }
1125
+ if (houdini_escape_html0(&buf, (const uint8_t *)RSTRING_PTR(rb_text),
1126
+ RSTRING_LEN(rb_text), 0)) {
1127
+ result = (char *)cmark_strbuf_detach(&buf);
1128
+ return rb_str_new2(result);
1129
+ }
1136
1130
 
1137
- return rb_text;
1131
+ return rb_text;
1138
1132
  }
1139
1133
 
1140
1134
  VALUE rb_Markly_extensions(VALUE self) {
1141
- cmark_llist *exts, *it;
1142
- cmark_syntax_extension *ext;
1143
- VALUE ary = rb_ary_new();
1144
-
1145
- cmark_mem *mem = cmark_get_default_mem_allocator();
1146
- exts = cmark_list_syntax_extensions(mem);
1147
- for (it = exts; it; it = it->next) {
1148
- ext = it->data;
1149
- rb_ary_push(ary, rb_str_new2(ext->name));
1150
- }
1135
+ cmark_llist *exts, *it;
1136
+ cmark_syntax_extension *ext;
1137
+ VALUE ary = rb_ary_new();
1138
+
1139
+ cmark_mem *mem = cmark_get_default_mem_allocator();
1140
+ exts = cmark_list_syntax_extensions(mem);
1141
+ for (it = exts; it; it = it->next) {
1142
+ ext = it->data;
1143
+ rb_ary_push(ary, rb_str_new2(ext->name));
1144
+ }
1151
1145
 
1152
- cmark_llist_free(mem, exts);
1146
+ cmark_llist_free(mem, exts);
1153
1147
 
1154
- return ary;
1148
+ return ary;
1155
1149
  }
1156
1150
 
1157
- __attribute__((visibility("default"))) void Init_markly() {
1158
- sym_document = ID2SYM(rb_intern("document"));
1159
- sym_blockquote = ID2SYM(rb_intern("blockquote"));
1160
- sym_list = ID2SYM(rb_intern("list"));
1161
- sym_list_item = ID2SYM(rb_intern("list_item"));
1162
- sym_code_block = ID2SYM(rb_intern("code_block"));
1163
- sym_html = ID2SYM(rb_intern("html"));
1164
- sym_paragraph = ID2SYM(rb_intern("paragraph"));
1165
- sym_header = ID2SYM(rb_intern("header"));
1166
- sym_hrule = ID2SYM(rb_intern("hrule"));
1167
- sym_text = ID2SYM(rb_intern("text"));
1168
- sym_softbreak = ID2SYM(rb_intern("softbreak"));
1169
- sym_linebreak = ID2SYM(rb_intern("linebreak"));
1170
- sym_code = ID2SYM(rb_intern("code"));
1171
- sym_inline_html = ID2SYM(rb_intern("inline_html"));
1172
- sym_emph = ID2SYM(rb_intern("emph"));
1173
- sym_strong = ID2SYM(rb_intern("strong"));
1174
- sym_link = ID2SYM(rb_intern("link"));
1175
- sym_image = ID2SYM(rb_intern("image"));
1176
- sym_footnote_reference = ID2SYM(rb_intern("footnote_reference"));
1177
- sym_footnote_definition = ID2SYM(rb_intern("footnote_definition"));
1178
-
1179
- sym_bullet_list = ID2SYM(rb_intern("bullet_list"));
1180
- sym_ordered_list = ID2SYM(rb_intern("ordered_list"));
1181
-
1182
- sym_left = ID2SYM(rb_intern("left"));
1183
- sym_right = ID2SYM(rb_intern("right"));
1184
- sym_center = ID2SYM(rb_intern("center"));
1185
-
1186
- rb_Markly = rb_define_module("Markly");
1187
- rb_define_singleton_method(rb_Markly, "extensions", rb_Markly_extensions, 0);
1188
-
1189
- rb_Markly_Error = rb_define_class_under(rb_Markly, "Error", rb_eStandardError);
1190
- rb_define_singleton_method(rb_Markly_Node, "parse", rb_Markly_Parser_parse, 1);
1191
-
1192
- rb_Markly_Parser = rb_define_class_under(rb_Markly, "Parser", rb_cObject);
1151
+ __attribute__((visibility("default"))) void Init_markly(void) {
1152
+ sym_document = ID2SYM(rb_intern("document"));
1153
+ sym_blockquote = ID2SYM(rb_intern("blockquote"));
1154
+ sym_list = ID2SYM(rb_intern("list"));
1155
+ sym_list_item = ID2SYM(rb_intern("list_item"));
1156
+ sym_code_block = ID2SYM(rb_intern("code_block"));
1157
+ sym_html = ID2SYM(rb_intern("html"));
1158
+ sym_paragraph = ID2SYM(rb_intern("paragraph"));
1159
+ sym_header = ID2SYM(rb_intern("header"));
1160
+ sym_hrule = ID2SYM(rb_intern("hrule"));
1161
+ sym_text = ID2SYM(rb_intern("text"));
1162
+ sym_softbreak = ID2SYM(rb_intern("softbreak"));
1163
+ sym_linebreak = ID2SYM(rb_intern("linebreak"));
1164
+ sym_code = ID2SYM(rb_intern("code"));
1165
+ sym_inline_html = ID2SYM(rb_intern("inline_html"));
1166
+ sym_emph = ID2SYM(rb_intern("emph"));
1167
+ sym_strong = ID2SYM(rb_intern("strong"));
1168
+ sym_link = ID2SYM(rb_intern("link"));
1169
+ sym_image = ID2SYM(rb_intern("image"));
1170
+ sym_footnote_reference = ID2SYM(rb_intern("footnote_reference"));
1171
+ sym_footnote_definition = ID2SYM(rb_intern("footnote_definition"));
1172
+
1173
+ sym_bullet_list = ID2SYM(rb_intern("bullet_list"));
1174
+ sym_ordered_list = ID2SYM(rb_intern("ordered_list"));
1175
+
1176
+ sym_left = ID2SYM(rb_intern("left"));
1177
+ sym_right = ID2SYM(rb_intern("right"));
1178
+ sym_center = ID2SYM(rb_intern("center"));
1179
+
1180
+ rb_Markly = rb_define_module("Markly");
1181
+ rb_define_singleton_method(rb_Markly, "extensions", rb_Markly_extensions, 0);
1182
+
1183
+ rb_Markly_Error = rb_define_class_under(rb_Markly, "Error", rb_eStandardError);
1184
+ rb_define_singleton_method(rb_Markly_Node, "parse", rb_Markly_Parser_parse, 1);
1185
+
1186
+ rb_Markly_Parser = rb_define_class_under(rb_Markly, "Parser", rb_cObject);
1193
1187
  rb_define_alloc_func(rb_Markly_Parser, rb_Markly_Parser_alloc);
1194
1188
  rb_define_method(rb_Markly_Parser, "initialize", rb_Markly_Parser_initialize, 1);
1195
1189
  rb_define_method(rb_Markly_Parser, "enable", rb_Markly_Parser_enable, 1);
1196
1190
  rb_define_method(rb_Markly_Parser, "parse", rb_Markly_Parser_parse, 1);
1197
1191
 
1198
- rb_Markly_Node = rb_define_class_under(rb_Markly, "Node", rb_cObject);
1199
- rb_define_singleton_method(rb_Markly_Node, "new", rb_node_new, 1);
1192
+ rb_Markly_Node = rb_define_class_under(rb_Markly, "Node", rb_cObject);
1193
+ rb_undef_alloc_func(rb_Markly_Node);
1194
+ rb_define_singleton_method(rb_Markly_Node, "new", rb_node_new, 1);
1200
1195
 
1201
1196
  rb_define_method(rb_Markly_Node, "replace", rb_node_replace, 1);
1202
1197
 
1203
- rb_define_method(rb_Markly_Node, "string_content", rb_node_get_string_content, 0);
1204
- rb_define_method(rb_Markly_Node, "string_content=", rb_node_set_string_content, 1);
1205
- rb_define_method(rb_Markly_Node, "type", rb_node_get_type, 0);
1206
- rb_define_method(rb_Markly_Node, "type_string", rb_node_get_type_string, 0);
1207
- rb_define_method(rb_Markly_Node, "source_position", rb_node_get_source_position, 0);
1208
- rb_define_method(rb_Markly_Node, "delete", rb_node_unlink, 0);
1209
- rb_define_method(rb_Markly_Node, "first_child", rb_node_first_child, 0);
1210
- rb_define_method(rb_Markly_Node, "next", rb_node_next, 0);
1211
- rb_define_method(rb_Markly_Node, "insert_before", rb_node_insert_before, 1);
1212
- rb_define_method(rb_Markly_Node, "_render_html", rb_render_html, 2);
1213
- rb_define_method(rb_Markly_Node, "_render_commonmark", rb_render_commonmark, -1);
1214
- rb_define_method(rb_Markly_Node, "_render_plaintext", rb_render_plaintext, -1);
1215
- rb_define_method(rb_Markly_Node, "insert_after", rb_node_insert_after, 1);
1216
- rb_define_method(rb_Markly_Node, "prepend_child", rb_node_prepend_child, 1);
1217
- rb_define_method(rb_Markly_Node, "append_child", rb_node_append_child, 1);
1218
- rb_define_method(rb_Markly_Node, "last_child", rb_node_last_child, 0);
1219
- rb_define_method(rb_Markly_Node, "parent", rb_node_parent, 0);
1220
- rb_define_method(rb_Markly_Node, "previous", rb_node_previous, 0);
1221
- rb_define_method(rb_Markly_Node, "url", rb_node_get_url, 0);
1222
- rb_define_method(rb_Markly_Node, "url=", rb_node_set_url, 1);
1223
- rb_define_method(rb_Markly_Node, "title", rb_node_get_title, 0);
1224
- rb_define_method(rb_Markly_Node, "title=", rb_node_set_title, 1);
1225
- rb_define_method(rb_Markly_Node, "header_level", rb_node_get_header_level, 0);
1226
- rb_define_method(rb_Markly_Node, "header_level=", rb_node_set_header_level, 1);
1227
- rb_define_method(rb_Markly_Node, "list_type", rb_node_get_list_type, 0);
1228
- rb_define_method(rb_Markly_Node, "list_type=", rb_node_set_list_type, 1);
1229
- rb_define_method(rb_Markly_Node, "list_start", rb_node_get_list_start, 0);
1230
- rb_define_method(rb_Markly_Node, "list_start=", rb_node_set_list_start, 1);
1231
- rb_define_method(rb_Markly_Node, "list_tight", rb_node_get_list_tight, 0);
1232
- rb_define_method(rb_Markly_Node, "list_tight=", rb_node_set_list_tight, 1);
1233
- rb_define_method(rb_Markly_Node, "fence_info", rb_node_get_fence_info, 0);
1234
- rb_define_method(rb_Markly_Node, "fence_info=", rb_node_set_fence_info, 1);
1235
- rb_define_method(rb_Markly_Node, "table_alignments", rb_node_get_table_alignments, 0);
1236
- rb_define_method(rb_Markly_Node, "tasklist_state", rb_node_get_tasklist_state, 0);
1237
- rb_define_method(rb_Markly_Node, "tasklist_item_checked?", rb_node_get_tasklist_item_checked, 0);
1238
- rb_define_method(rb_Markly_Node, "tasklist_item_checked=", rb_node_set_tasklist_item_checked, 1);
1239
-
1240
- rb_define_method(rb_Markly_Node, "html_escape_href", rb_html_escape_href, 1);
1241
- rb_define_method(rb_Markly_Node, "html_escape_html", rb_html_escape_html, 1);
1242
-
1243
- cmark_gfm_core_extensions_ensure_registered();
1198
+ rb_define_method(rb_Markly_Node, "string_content", rb_node_get_string_content, 0);
1199
+ rb_define_method(rb_Markly_Node, "string_content=", rb_node_set_string_content, 1);
1200
+ rb_define_method(rb_Markly_Node, "type", rb_node_get_type, 0);
1201
+ rb_define_method(rb_Markly_Node, "type_string", rb_node_get_type_string, 0);
1202
+ rb_define_method(rb_Markly_Node, "source_position", rb_node_get_source_position, 0);
1203
+ rb_define_method(rb_Markly_Node, "delete", rb_node_unlink, 0);
1204
+ rb_define_method(rb_Markly_Node, "first_child", rb_node_first_child, 0);
1205
+ rb_define_method(rb_Markly_Node, "next", rb_node_next, 0);
1206
+ rb_define_method(rb_Markly_Node, "insert_before", rb_node_insert_before, 1);
1207
+ rb_define_method(rb_Markly_Node, "_render_html", rb_render_html, 2);
1208
+ rb_define_method(rb_Markly_Node, "_render_commonmark", rb_render_commonmark, -1);
1209
+ rb_define_method(rb_Markly_Node, "_render_plaintext", rb_render_plaintext, -1);
1210
+ rb_define_method(rb_Markly_Node, "insert_after", rb_node_insert_after, 1);
1211
+ rb_define_method(rb_Markly_Node, "prepend_child", rb_node_prepend_child, 1);
1212
+ rb_define_method(rb_Markly_Node, "append_child", rb_node_append_child, 1);
1213
+ rb_define_method(rb_Markly_Node, "last_child", rb_node_last_child, 0);
1214
+ rb_define_method(rb_Markly_Node, "parent", rb_node_parent, 0);
1215
+ rb_define_method(rb_Markly_Node, "previous", rb_node_previous, 0);
1216
+ rb_define_method(rb_Markly_Node, "url", rb_node_get_url, 0);
1217
+ rb_define_method(rb_Markly_Node, "url=", rb_node_set_url, 1);
1218
+ rb_define_method(rb_Markly_Node, "title", rb_node_get_title, 0);
1219
+ rb_define_method(rb_Markly_Node, "title=", rb_node_set_title, 1);
1220
+ rb_define_method(rb_Markly_Node, "header_level", rb_node_get_header_level, 0);
1221
+ rb_define_method(rb_Markly_Node, "header_level=", rb_node_set_header_level, 1);
1222
+ rb_define_method(rb_Markly_Node, "list_type", rb_node_get_list_type, 0);
1223
+ rb_define_method(rb_Markly_Node, "list_type=", rb_node_set_list_type, 1);
1224
+ rb_define_method(rb_Markly_Node, "list_start", rb_node_get_list_start, 0);
1225
+ rb_define_method(rb_Markly_Node, "list_start=", rb_node_set_list_start, 1);
1226
+ rb_define_method(rb_Markly_Node, "list_tight", rb_node_get_list_tight, 0);
1227
+ rb_define_method(rb_Markly_Node, "list_tight=", rb_node_set_list_tight, 1);
1228
+ rb_define_method(rb_Markly_Node, "fence_info", rb_node_get_fence_info, 0);
1229
+ rb_define_method(rb_Markly_Node, "fence_info=", rb_node_set_fence_info, 1);
1230
+ rb_define_method(rb_Markly_Node, "table_alignments", rb_node_get_table_alignments, 0);
1231
+ rb_define_method(rb_Markly_Node, "tasklist_item_checked?", rb_node_get_tasklist_item_checked, 0);
1232
+ rb_define_method(rb_Markly_Node, "tasklist_item_checked=", rb_node_set_tasklist_item_checked, 1);
1233
+
1234
+ rb_define_method(rb_Markly_Node, "parent_footnote_def", rb_node_get_parent_footnote_def, 0);
1235
+
1236
+ rb_define_method(rb_Markly_Node, "html_escape_href", rb_html_escape_href, 1);
1237
+ rb_define_method(rb_Markly_Node, "html_escape_html", rb_html_escape_html, 1);
1238
+
1239
+ cmark_gfm_core_extensions_ensure_registered();
1244
1240
  }