commonmarker 0.17.7.1 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +19 -17
  3. data/commonmarker.gemspec +1 -1
  4. data/ext/commonmarker/arena.c +2 -2
  5. data/ext/commonmarker/autolink.h +3 -3
  6. data/ext/commonmarker/blocks.c +21 -15
  7. data/ext/commonmarker/buffer.h +23 -23
  8. data/ext/commonmarker/chunk.h +1 -1
  9. data/ext/commonmarker/cmark-gfm-core-extensions.h +28 -0
  10. data/ext/commonmarker/{cmark_extension_api.h → cmark-gfm-extension_api.h} +86 -69
  11. data/ext/commonmarker/cmark-gfm-extensions_export.h +42 -0
  12. data/ext/commonmarker/{cmark.h → cmark-gfm.h} +118 -96
  13. data/ext/commonmarker/cmark-gfm_export.h +42 -0
  14. data/ext/commonmarker/cmark-gfm_version.h +7 -0
  15. data/ext/commonmarker/cmark.c +3 -3
  16. data/ext/commonmarker/cmark_ctype.h +6 -6
  17. data/ext/commonmarker/commonmark.c +8 -4
  18. data/ext/commonmarker/commonmarker.c +33 -15
  19. data/ext/commonmarker/commonmarker.h +1 -1
  20. data/ext/commonmarker/core-extensions.c +2 -2
  21. data/ext/commonmarker/ext_scanners.h +1 -1
  22. data/ext/commonmarker/footnotes.c +1 -1
  23. data/ext/commonmarker/houdini.h +6 -6
  24. data/ext/commonmarker/houdini_href_e.c +2 -2
  25. data/ext/commonmarker/html.c +15 -7
  26. data/ext/commonmarker/inlines.c +36 -5
  27. data/ext/commonmarker/inlines.h +1 -1
  28. data/ext/commonmarker/iterator.c +1 -1
  29. data/ext/commonmarker/iterator.h +1 -1
  30. data/ext/commonmarker/latex.c +1 -1
  31. data/ext/commonmarker/linked_list.c +1 -1
  32. data/ext/commonmarker/man.c +1 -1
  33. data/ext/commonmarker/node.c +17 -3
  34. data/ext/commonmarker/node.h +4 -4
  35. data/ext/commonmarker/plugin.h +2 -2
  36. data/ext/commonmarker/references.c +1 -1
  37. data/ext/commonmarker/registry.c +1 -1
  38. data/ext/commonmarker/registry.h +4 -4
  39. data/ext/commonmarker/render.c +1 -1
  40. data/ext/commonmarker/scanners.c +10550 -18051
  41. data/ext/commonmarker/scanners.h +1 -1
  42. data/ext/commonmarker/strikethrough.c +13 -3
  43. data/ext/commonmarker/strikethrough.h +3 -3
  44. data/ext/commonmarker/syntax_extension.c +11 -1
  45. data/ext/commonmarker/syntax_extension.h +4 -2
  46. data/ext/commonmarker/table.c +88 -9
  47. data/ext/commonmarker/table.h +7 -3
  48. data/ext/commonmarker/tagfilter.h +3 -3
  49. data/ext/commonmarker/utf8.h +6 -6
  50. data/ext/commonmarker/xml.c +10 -3
  51. data/lib/commonmarker/config.rb +4 -1
  52. data/lib/commonmarker/node.rb +6 -4
  53. data/lib/commonmarker/renderer/html_renderer.rb +12 -12
  54. data/lib/commonmarker/version.rb +1 -1
  55. data/test/test_extensions.rb +52 -1
  56. data/test/test_footnotes.rb +1 -1
  57. data/test/test_options.rb +35 -0
  58. data/test/test_spec.rb +4 -4
  59. metadata +12 -10
  60. data/ext/commonmarker/cmark_export.h +0 -42
  61. data/ext/commonmarker/cmark_version.h +0 -8
  62. data/ext/commonmarker/cmarkextensions_export.h +0 -42
  63. data/ext/commonmarker/core-extensions.h +0 -25
@@ -1,10 +1,10 @@
1
- #ifndef CMARK_CMARK_H
2
- #define CMARK_CMARK_H
1
+ #ifndef CMARK_GFM_H
2
+ #define CMARK_GFM_H
3
3
 
4
4
  #include <stdio.h>
5
5
  #include <stdint.h>
6
- #include "cmark_export.h"
7
- #include "cmark_version.h"
6
+ #include "cmark-gfm_export.h"
7
+ #include "cmark-gfm_version.h"
8
8
 
9
9
  #ifdef __cplusplus
10
10
  extern "C" {
@@ -25,7 +25,7 @@ extern "C" {
25
25
  * UTF-8-encoded string. It is the caller's responsibility
26
26
  * to free the returned buffer.
27
27
  */
28
- CMARK_EXPORT
28
+ CMARK_GFM_EXPORT
29
29
  char *cmark_markdown_to_html(const char *text, size_t len, int options);
30
30
 
31
31
  /** ## Node Structure
@@ -92,6 +92,7 @@ typedef enum {
92
92
  typedef struct cmark_node cmark_node;
93
93
  typedef struct cmark_parser cmark_parser;
94
94
  typedef struct cmark_iter cmark_iter;
95
+ typedef struct cmark_syntax_extension cmark_syntax_extension;
95
96
 
96
97
  /**
97
98
  * ## Custom memory allocator support
@@ -109,19 +110,19 @@ typedef struct cmark_mem {
109
110
  /** The default memory allocator; uses the system's calloc,
110
111
  * realloc and free.
111
112
  */
112
- CMARK_EXPORT
113
+ CMARK_GFM_EXPORT
113
114
  cmark_mem *cmark_get_default_mem_allocator();
114
115
 
115
116
  /** An arena allocator; uses system calloc to allocate large
116
117
  * slabs of memory. Memory in these slabs is not reused at all.
117
118
  */
118
- CMARK_EXPORT
119
+ CMARK_GFM_EXPORT
119
120
  cmark_mem *cmark_get_arena_mem_allocator();
120
121
 
121
122
  /** Resets the arena allocator, quickly returning all used memory
122
123
  * to the operating system.
123
124
  */
124
- CMARK_EXPORT
125
+ CMARK_GFM_EXPORT
125
126
  void cmark_arena_reset(void);
126
127
 
127
128
  /** Callback for freeing user data with a 'cmark_mem' context.
@@ -151,7 +152,7 @@ typedef struct _cmark_llist
151
152
  /** Append an element to the linked list, return the possibly modified
152
153
  * head of the list.
153
154
  */
154
- CMARK_EXPORT
155
+ CMARK_GFM_EXPORT
155
156
  cmark_llist * cmark_llist_append (cmark_mem * mem,
156
157
  cmark_llist * head,
157
158
  void * data);
@@ -159,14 +160,14 @@ cmark_llist * cmark_llist_append (cmark_mem * mem,
159
160
  /** Free the list starting with 'head', calling 'free_func' with the
160
161
  * data pointer of each of its elements
161
162
  */
162
- CMARK_EXPORT
163
+ CMARK_GFM_EXPORT
163
164
  void cmark_llist_free_full (cmark_mem * mem,
164
165
  cmark_llist * head,
165
166
  cmark_free_func free_func);
166
167
 
167
168
  /** Free the list starting with 'head'
168
169
  */
169
- CMARK_EXPORT
170
+ CMARK_GFM_EXPORT
170
171
  void cmark_llist_free (cmark_mem * mem,
171
172
  cmark_llist * head);
172
173
 
@@ -178,18 +179,25 @@ void cmark_llist_free (cmark_mem * mem,
178
179
  * other required properties, which it is the caller's responsibility
179
180
  * to assign.
180
181
  */
181
- CMARK_EXPORT cmark_node *cmark_node_new(cmark_node_type type);
182
+ CMARK_GFM_EXPORT cmark_node *cmark_node_new(cmark_node_type type);
182
183
 
183
184
  /** Same as `cmark_node_new`, but explicitly listing the memory
184
185
  * allocator used to allocate the node. Note: be sure to use the same
185
186
  * allocator for every node in a tree, or bad things can happen.
186
187
  */
187
- CMARK_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type,
188
+ CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type,
188
189
  cmark_mem *mem);
189
190
 
191
+ CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_ext(cmark_node_type type,
192
+ cmark_syntax_extension *extension);
193
+
194
+ CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_mem_and_ext(cmark_node_type type,
195
+ cmark_mem *mem,
196
+ cmark_syntax_extension *extension);
197
+
190
198
  /** Frees the memory allocated for a node and any children.
191
199
  */
192
- CMARK_EXPORT void cmark_node_free(cmark_node *node);
200
+ CMARK_GFM_EXPORT void cmark_node_free(cmark_node *node);
193
201
 
194
202
  /**
195
203
  * ## Tree Traversal
@@ -198,24 +206,24 @@ CMARK_EXPORT void cmark_node_free(cmark_node *node);
198
206
  /** Returns the next node in the sequence after 'node', or NULL if
199
207
  * there is none.
200
208
  */
201
- CMARK_EXPORT cmark_node *cmark_node_next(cmark_node *node);
209
+ CMARK_GFM_EXPORT cmark_node *cmark_node_next(cmark_node *node);
202
210
 
203
211
  /** Returns the previous node in the sequence after 'node', or NULL if
204
212
  * there is none.
205
213
  */
206
- CMARK_EXPORT cmark_node *cmark_node_previous(cmark_node *node);
214
+ CMARK_GFM_EXPORT cmark_node *cmark_node_previous(cmark_node *node);
207
215
 
208
216
  /** Returns the parent of 'node', or NULL if there is none.
209
217
  */
210
- CMARK_EXPORT cmark_node *cmark_node_parent(cmark_node *node);
218
+ CMARK_GFM_EXPORT cmark_node *cmark_node_parent(cmark_node *node);
211
219
 
212
220
  /** Returns the first child of 'node', or NULL if 'node' has no children.
213
221
  */
214
- CMARK_EXPORT cmark_node *cmark_node_first_child(cmark_node *node);
222
+ CMARK_GFM_EXPORT cmark_node *cmark_node_first_child(cmark_node *node);
215
223
 
216
224
  /** Returns the last child of 'node', or NULL if 'node' has no children.
217
225
  */
218
- CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
226
+ CMARK_GFM_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
219
227
 
220
228
  /**
221
229
  * ## Iterator
@@ -274,40 +282,40 @@ typedef enum {
274
282
  * The memory allocated for the iterator should be released using
275
283
  * 'cmark_iter_free' when it is no longer needed.
276
284
  */
277
- CMARK_EXPORT
285
+ CMARK_GFM_EXPORT
278
286
  cmark_iter *cmark_iter_new(cmark_node *root);
279
287
 
280
288
  /** Frees the memory allocated for an iterator.
281
289
  */
282
- CMARK_EXPORT
290
+ CMARK_GFM_EXPORT
283
291
  void cmark_iter_free(cmark_iter *iter);
284
292
 
285
293
  /** Advances to the next node and returns the event type (`CMARK_EVENT_ENTER`,
286
294
  * `CMARK_EVENT_EXIT` or `CMARK_EVENT_DONE`).
287
295
  */
288
- CMARK_EXPORT
296
+ CMARK_GFM_EXPORT
289
297
  cmark_event_type cmark_iter_next(cmark_iter *iter);
290
298
 
291
299
  /** Returns the current node.
292
300
  */
293
- CMARK_EXPORT
301
+ CMARK_GFM_EXPORT
294
302
  cmark_node *cmark_iter_get_node(cmark_iter *iter);
295
303
 
296
304
  /** Returns the current event type.
297
305
  */
298
- CMARK_EXPORT
306
+ CMARK_GFM_EXPORT
299
307
  cmark_event_type cmark_iter_get_event_type(cmark_iter *iter);
300
308
 
301
309
  /** Returns the root node.
302
310
  */
303
- CMARK_EXPORT
311
+ CMARK_GFM_EXPORT
304
312
  cmark_node *cmark_iter_get_root(cmark_iter *iter);
305
313
 
306
314
  /** Resets the iterator so that the current node is 'current' and
307
315
  * the event type is 'event_type'. The new current node must be a
308
316
  * descendant of the root node or the root node itself.
309
317
  */
310
- CMARK_EXPORT
318
+ CMARK_GFM_EXPORT
311
319
  void cmark_iter_reset(cmark_iter *iter, cmark_node *current,
312
320
  cmark_event_type event_type);
313
321
 
@@ -317,42 +325,42 @@ void cmark_iter_reset(cmark_iter *iter, cmark_node *current,
317
325
 
318
326
  /** Returns the user data of 'node'.
319
327
  */
320
- CMARK_EXPORT void *cmark_node_get_user_data(cmark_node *node);
328
+ CMARK_GFM_EXPORT void *cmark_node_get_user_data(cmark_node *node);
321
329
 
322
330
  /** Sets arbitrary user data for 'node'. Returns 1 on success,
323
331
  * 0 on failure.
324
332
  */
325
- CMARK_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data);
333
+ CMARK_GFM_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data);
326
334
 
327
335
  /** Set free function for user data */
328
- CMARK_EXPORT
336
+ CMARK_GFM_EXPORT
329
337
  int cmark_node_set_user_data_free_func(cmark_node *node,
330
338
  cmark_free_func free_func);
331
339
 
332
340
  /** Returns the type of 'node', or `CMARK_NODE_NONE` on error.
333
341
  */
334
- CMARK_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node);
342
+ CMARK_GFM_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node);
335
343
 
336
344
  /** Like 'cmark_node_get_type', but returns a string representation
337
345
  of the type, or `"<unknown>"`.
338
346
  */
339
- CMARK_EXPORT
347
+ CMARK_GFM_EXPORT
340
348
  const char *cmark_node_get_type_string(cmark_node *node);
341
349
 
342
350
  /** Returns the string contents of 'node', or an empty
343
351
  string if none is set. Returns NULL if called on a
344
352
  node that does not have string content.
345
353
  */
346
- CMARK_EXPORT const char *cmark_node_get_literal(cmark_node *node);
354
+ CMARK_GFM_EXPORT const char *cmark_node_get_literal(cmark_node *node);
347
355
 
348
356
  /** Sets the string contents of 'node'. Returns 1 on success,
349
357
  * 0 on failure.
350
358
  */
351
- CMARK_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content);
359
+ CMARK_GFM_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content);
352
360
 
353
361
  /** Returns the heading level of 'node', or 0 if 'node' is not a heading.
354
362
  */
355
- CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node);
363
+ CMARK_GFM_EXPORT int cmark_node_get_heading_level(cmark_node *node);
356
364
 
357
365
  /* For backwards compatibility */
358
366
  #define cmark_node_get_header_level cmark_node_get_heading_level
@@ -360,126 +368,126 @@ CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node);
360
368
 
361
369
  /** Sets the heading level of 'node', returning 1 on success and 0 on error.
362
370
  */
363
- CMARK_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level);
371
+ CMARK_GFM_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level);
364
372
 
365
373
  /** Returns the list type of 'node', or `CMARK_NO_LIST` if 'node'
366
374
  * is not a list.
367
375
  */
368
- CMARK_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node);
376
+ CMARK_GFM_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node);
369
377
 
370
378
  /** Sets the list type of 'node', returning 1 on success and 0 on error.
371
379
  */
372
- CMARK_EXPORT int cmark_node_set_list_type(cmark_node *node,
380
+ CMARK_GFM_EXPORT int cmark_node_set_list_type(cmark_node *node,
373
381
  cmark_list_type type);
374
382
 
375
383
  /** Returns the list delimiter type of 'node', or `CMARK_NO_DELIM` if 'node'
376
384
  * is not a list.
377
385
  */
378
- CMARK_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node);
386
+ CMARK_GFM_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node);
379
387
 
380
388
  /** Sets the list delimiter type of 'node', returning 1 on success and 0
381
389
  * on error.
382
390
  */
383
- CMARK_EXPORT int cmark_node_set_list_delim(cmark_node *node,
391
+ CMARK_GFM_EXPORT int cmark_node_set_list_delim(cmark_node *node,
384
392
  cmark_delim_type delim);
385
393
 
386
394
  /** Returns starting number of 'node', if it is an ordered list, otherwise 0.
387
395
  */
388
- CMARK_EXPORT int cmark_node_get_list_start(cmark_node *node);
396
+ CMARK_GFM_EXPORT int cmark_node_get_list_start(cmark_node *node);
389
397
 
390
398
  /** Sets starting number of 'node', if it is an ordered list. Returns 1
391
399
  * on success, 0 on failure.
392
400
  */
393
- CMARK_EXPORT int cmark_node_set_list_start(cmark_node *node, int start);
401
+ CMARK_GFM_EXPORT int cmark_node_set_list_start(cmark_node *node, int start);
394
402
 
395
403
  /** Returns 1 if 'node' is a tight list, 0 otherwise.
396
404
  */
397
- CMARK_EXPORT int cmark_node_get_list_tight(cmark_node *node);
405
+ CMARK_GFM_EXPORT int cmark_node_get_list_tight(cmark_node *node);
398
406
 
399
407
  /** Sets the "tightness" of a list. Returns 1 on success, 0 on failure.
400
408
  */
401
- CMARK_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight);
409
+ CMARK_GFM_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight);
402
410
 
403
411
  /** Returns the info string from a fenced code block.
404
412
  */
405
- CMARK_EXPORT const char *cmark_node_get_fence_info(cmark_node *node);
413
+ CMARK_GFM_EXPORT const char *cmark_node_get_fence_info(cmark_node *node);
406
414
 
407
415
  /** Sets the info string in a fenced code block, returning 1 on
408
416
  * success and 0 on failure.
409
417
  */
410
- CMARK_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info);
418
+ CMARK_GFM_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info);
411
419
 
412
420
  /** Sets code blocks fencing details
413
421
  */
414
- CMARK_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced,
422
+ CMARK_GFM_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced,
415
423
  int length, int offset, char character);
416
424
 
417
425
  /** Returns code blocks fencing details
418
426
  */
419
- CMARK_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character);
427
+ CMARK_GFM_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character);
420
428
 
421
429
  /** Returns the URL of a link or image 'node', or an empty string
422
430
  if no URL is set. Returns NULL if called on a node that is
423
431
  not a link or image.
424
432
  */
425
- CMARK_EXPORT const char *cmark_node_get_url(cmark_node *node);
433
+ CMARK_GFM_EXPORT const char *cmark_node_get_url(cmark_node *node);
426
434
 
427
435
  /** Sets the URL of a link or image 'node'. Returns 1 on success,
428
436
  * 0 on failure.
429
437
  */
430
- CMARK_EXPORT int cmark_node_set_url(cmark_node *node, const char *url);
438
+ CMARK_GFM_EXPORT int cmark_node_set_url(cmark_node *node, const char *url);
431
439
 
432
440
  /** Returns the title of a link or image 'node', or an empty
433
441
  string if no title is set. Returns NULL if called on a node
434
442
  that is not a link or image.
435
443
  */
436
- CMARK_EXPORT const char *cmark_node_get_title(cmark_node *node);
444
+ CMARK_GFM_EXPORT const char *cmark_node_get_title(cmark_node *node);
437
445
 
438
446
  /** Sets the title of a link or image 'node'. Returns 1 on success,
439
447
  * 0 on failure.
440
448
  */
441
- CMARK_EXPORT int cmark_node_set_title(cmark_node *node, const char *title);
449
+ CMARK_GFM_EXPORT int cmark_node_set_title(cmark_node *node, const char *title);
442
450
 
443
451
  /** Returns the literal "on enter" text for a custom 'node', or
444
452
  an empty string if no on_enter is set. Returns NULL if called
445
453
  on a non-custom node.
446
454
  */
447
- CMARK_EXPORT const char *cmark_node_get_on_enter(cmark_node *node);
455
+ CMARK_GFM_EXPORT const char *cmark_node_get_on_enter(cmark_node *node);
448
456
 
449
457
  /** Sets the literal text to render "on enter" for a custom 'node'.
450
458
  Any children of the node will be rendered after this text.
451
459
  Returns 1 on success 0 on failure.
452
460
  */
453
- CMARK_EXPORT int cmark_node_set_on_enter(cmark_node *node,
461
+ CMARK_GFM_EXPORT int cmark_node_set_on_enter(cmark_node *node,
454
462
  const char *on_enter);
455
463
 
456
464
  /** Returns the literal "on exit" text for a custom 'node', or
457
465
  an empty string if no on_exit is set. Returns NULL if
458
466
  called on a non-custom node.
459
467
  */
460
- CMARK_EXPORT const char *cmark_node_get_on_exit(cmark_node *node);
468
+ CMARK_GFM_EXPORT const char *cmark_node_get_on_exit(cmark_node *node);
461
469
 
462
470
  /** Sets the literal text to render "on exit" for a custom 'node'.
463
471
  Any children of the node will be rendered before this text.
464
472
  Returns 1 on success 0 on failure.
465
473
  */
466
- CMARK_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit);
474
+ CMARK_GFM_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit);
467
475
 
468
476
  /** Returns the line on which 'node' begins.
469
477
  */
470
- CMARK_EXPORT int cmark_node_get_start_line(cmark_node *node);
478
+ CMARK_GFM_EXPORT int cmark_node_get_start_line(cmark_node *node);
471
479
 
472
480
  /** Returns the column at which 'node' begins.
473
481
  */
474
- CMARK_EXPORT int cmark_node_get_start_column(cmark_node *node);
482
+ CMARK_GFM_EXPORT int cmark_node_get_start_column(cmark_node *node);
475
483
 
476
484
  /** Returns the line on which 'node' ends.
477
485
  */
478
- CMARK_EXPORT int cmark_node_get_end_line(cmark_node *node);
486
+ CMARK_GFM_EXPORT int cmark_node_get_end_line(cmark_node *node);
479
487
 
480
488
  /** Returns the column at which 'node' ends.
481
489
  */
482
- CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node);
490
+ CMARK_GFM_EXPORT int cmark_node_get_end_column(cmark_node *node);
483
491
 
484
492
  /**
485
493
  * ## Tree Manipulation
@@ -488,40 +496,40 @@ CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node);
488
496
  /** Unlinks a 'node', removing it from the tree, but not freeing its
489
497
  * memory. (Use 'cmark_node_free' for that.)
490
498
  */
491
- CMARK_EXPORT void cmark_node_unlink(cmark_node *node);
499
+ CMARK_GFM_EXPORT void cmark_node_unlink(cmark_node *node);
492
500
 
493
501
  /** Inserts 'sibling' before 'node'. Returns 1 on success, 0 on failure.
494
502
  */
495
- CMARK_EXPORT int cmark_node_insert_before(cmark_node *node,
503
+ CMARK_GFM_EXPORT int cmark_node_insert_before(cmark_node *node,
496
504
  cmark_node *sibling);
497
505
 
498
506
  /** Inserts 'sibling' after 'node'. Returns 1 on success, 0 on failure.
499
507
  */
500
- CMARK_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling);
508
+ CMARK_GFM_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling);
501
509
 
502
510
  /** Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does
503
511
  * not free its memory).
504
512
  * Returns 1 on success, 0 on failure.
505
513
  */
506
- CMARK_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode);
514
+ CMARK_GFM_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode);
507
515
 
508
516
  /** Adds 'child' to the beginning of the children of 'node'.
509
517
  * Returns 1 on success, 0 on failure.
510
518
  */
511
- CMARK_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child);
519
+ CMARK_GFM_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child);
512
520
 
513
521
  /** Adds 'child' to the end of the children of 'node'.
514
522
  * Returns 1 on success, 0 on failure.
515
523
  */
516
- CMARK_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child);
524
+ CMARK_GFM_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child);
517
525
 
518
526
  /** Consolidates adjacent text nodes.
519
527
  */
520
- CMARK_EXPORT void cmark_consolidate_text_nodes(cmark_node *root);
528
+ CMARK_GFM_EXPORT void cmark_consolidate_text_nodes(cmark_node *root);
521
529
 
522
530
  /** Ensures a node and all its children own their own chunk memory.
523
531
  */
524
- CMARK_EXPORT void cmark_node_own(cmark_node *root);
532
+ CMARK_GFM_EXPORT void cmark_node_own(cmark_node *root);
525
533
 
526
534
  /**
527
535
  * ## Parsing
@@ -547,27 +555,27 @@ CMARK_EXPORT void cmark_node_own(cmark_node *root);
547
555
 
548
556
  /** Creates a new parser object.
549
557
  */
550
- CMARK_EXPORT
558
+ CMARK_GFM_EXPORT
551
559
  cmark_parser *cmark_parser_new(int options);
552
560
 
553
561
  /** Creates a new parser object with the given memory allocator
554
562
  */
555
- CMARK_EXPORT
563
+ CMARK_GFM_EXPORT
556
564
  cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem);
557
565
 
558
566
  /** Frees memory allocated for a parser object.
559
567
  */
560
- CMARK_EXPORT
568
+ CMARK_GFM_EXPORT
561
569
  void cmark_parser_free(cmark_parser *parser);
562
570
 
563
571
  /** Feeds a string of length 'len' to 'parser'.
564
572
  */
565
- CMARK_EXPORT
573
+ CMARK_GFM_EXPORT
566
574
  void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len);
567
575
 
568
576
  /** Finish parsing and return a pointer to a tree of nodes.
569
577
  */
570
- CMARK_EXPORT
578
+ CMARK_GFM_EXPORT
571
579
  cmark_node *cmark_parser_finish(cmark_parser *parser);
572
580
 
573
581
  /** Parse a CommonMark document in 'buffer' of length 'len'.
@@ -575,14 +583,14 @@ cmark_node *cmark_parser_finish(cmark_parser *parser);
575
583
  * the node tree should be released using 'cmark_node_free'
576
584
  * when it is no longer needed.
577
585
  */
578
- CMARK_EXPORT
586
+ CMARK_GFM_EXPORT
579
587
  cmark_node *cmark_parse_document(const char *buffer, size_t len, int options);
580
588
 
581
589
  /** Parse a CommonMark document in file 'f', returning a pointer to
582
590
  * a tree of nodes. The memory allocated for the node tree should be
583
591
  * released using 'cmark_node_free' when it is no longer needed.
584
592
  */
585
- CMARK_EXPORT
593
+ CMARK_GFM_EXPORT
586
594
  cmark_node *cmark_parse_file(FILE *f, int options);
587
595
 
588
596
  /**
@@ -592,74 +600,74 @@ cmark_node *cmark_parse_file(FILE *f, int options);
592
600
  /** Render a 'node' tree as XML. It is the caller's responsibility
593
601
  * to free the returned buffer.
594
602
  */
595
- CMARK_EXPORT
603
+ CMARK_GFM_EXPORT
596
604
  char *cmark_render_xml(cmark_node *root, int options);
597
605
 
598
606
  /** As for 'cmark_render_xml', but specifying the allocator to use for
599
607
  * the resulting string.
600
608
  */
601
- CMARK_EXPORT
609
+ CMARK_GFM_EXPORT
602
610
  char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem);
603
611
 
604
612
  /** Render a 'node' tree as an HTML fragment. It is up to the user
605
613
  * to add an appropriate header and footer. It is the caller's
606
614
  * responsibility to free the returned buffer.
607
615
  */
608
- CMARK_EXPORT
616
+ CMARK_GFM_EXPORT
609
617
  char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions);
610
618
 
611
619
  /** As for 'cmark_render_html', but specifying the allocator to use for
612
620
  * the resulting string.
613
621
  */
614
- CMARK_EXPORT
622
+ CMARK_GFM_EXPORT
615
623
  char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem);
616
624
 
617
625
  /** Render a 'node' tree as a groff man page, without the header.
618
626
  * It is the caller's responsibility to free the returned buffer.
619
627
  */
620
- CMARK_EXPORT
628
+ CMARK_GFM_EXPORT
621
629
  char *cmark_render_man(cmark_node *root, int options, int width);
622
630
 
623
631
  /** As for 'cmark_render_man', but specifying the allocator to use for
624
632
  * the resulting string.
625
633
  */
626
- CMARK_EXPORT
634
+ CMARK_GFM_EXPORT
627
635
  char *cmark_render_man_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
628
636
 
629
637
  /** Render a 'node' tree as a commonmark document.
630
638
  * It is the caller's responsibility to free the returned buffer.
631
639
  */
632
- CMARK_EXPORT
640
+ CMARK_GFM_EXPORT
633
641
  char *cmark_render_commonmark(cmark_node *root, int options, int width);
634
642
 
635
643
  /** As for 'cmark_render_commonmark', but specifying the allocator to use for
636
644
  * the resulting string.
637
645
  */
638
- CMARK_EXPORT
646
+ CMARK_GFM_EXPORT
639
647
  char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
640
648
 
641
649
  /** Render a 'node' tree as a plain text document.
642
650
  * It is the caller's responsibility to free the returned buffer.
643
651
  */
644
- CMARK_EXPORT
652
+ CMARK_GFM_EXPORT
645
653
  char *cmark_render_plaintext(cmark_node *root, int options, int width);
646
654
 
647
655
  /** As for 'cmark_render_plaintext', but specifying the allocator to use for
648
656
  * the resulting string.
649
657
  */
650
- CMARK_EXPORT
658
+ CMARK_GFM_EXPORT
651
659
  char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
652
660
 
653
661
  /** Render a 'node' tree as a LaTeX document.
654
662
  * It is the caller's responsibility to free the returned buffer.
655
663
  */
656
- CMARK_EXPORT
664
+ CMARK_GFM_EXPORT
657
665
  char *cmark_render_latex(cmark_node *root, int options, int width);
658
666
 
659
667
  /** As for 'cmark_render_latex', but specifying the allocator to use for
660
668
  * the resulting string.
661
669
  */
662
- CMARK_EXPORT
670
+ CMARK_GFM_EXPORT
663
671
  char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
664
672
 
665
673
  /**
@@ -682,14 +690,6 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar
682
690
  */
683
691
  #define CMARK_OPT_HARDBREAKS (1 << 2)
684
692
 
685
- /** Suppress raw HTML and unsafe links (`javascript:`, `vbscript:`,
686
- * `file:`, and `data:`, except for `image/png`, `image/gif`,
687
- * `image/jpeg`, or `image/webp` mime types). Raw HTML is replaced
688
- * by a placeholder HTML comment. Unsafe links are replaced by
689
- * empty strings.
690
- */
691
- #define CMARK_OPT_SAFE (1 << 3)
692
-
693
693
  /** Render `softbreak` elements as spaces.
694
694
  */
695
695
  #define CMARK_OPT_NOBREAKS (1 << 4)
@@ -724,6 +724,28 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar
724
724
  */
725
725
  #define CMARK_OPT_FOOTNOTES (1 << 13)
726
726
 
727
+ /** Only parse strikethroughs if surrounded by exactly 2 tildes.
728
+ * Gives some compatibility with redcarpet.
729
+ */
730
+ #define CMARK_OPT_STRIKETHROUGH_DOUBLE_TILDE (1 << 14)
731
+
732
+ /** Use style attributes to align table cells instead of align attributes.
733
+ */
734
+ #define CMARK_OPT_TABLE_PREFER_STYLE_ATTRIBUTES (1 << 15)
735
+
736
+ /** Include the remainder of the info string in code blocks in
737
+ * a separate attribute.
738
+ */
739
+ #define CMARK_OPT_FULL_INFO_STRING (1 << 16)
740
+
741
+ /** Allow raw HTML and unsafe links, `javascript:`, `vbscript:`, `file:`, and
742
+ * all `data:` URLs -- by default, only `image/png`, `image/gif`, `image/jpeg`,
743
+ * or `image/webp` mime types are allowed. Without this option, raw HTML is
744
+ * replaced by a placeholder HTML comment, and unsafe links are replaced by
745
+ * empty strings.
746
+ */
747
+ #define CMARK_OPT_UNSAFE (1 << 17)
748
+
727
749
  /**
728
750
  * ## Version information
729
751
  */
@@ -737,13 +759,13 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar
737
759
  *
738
760
  * In hexadecimal format, the number 0x010203 represents version 1.2.3.
739
761
  */
740
- CMARK_EXPORT
762
+ CMARK_GFM_EXPORT
741
763
  int cmark_version(void);
742
764
 
743
765
  /** The library version string for runtime checks. Also available as
744
766
  * macro CMARK_VERSION_STRING for compile time checks.
745
767
  */
746
- CMARK_EXPORT
768
+ CMARK_GFM_EXPORT
747
769
  const char *cmark_version_string(void);
748
770
 
749
771
  /** # AUTHORS
@@ -0,0 +1,42 @@
1
+
2
+ #ifndef CMARK_GFM_EXPORT_H
3
+ #define CMARK_GFM_EXPORT_H
4
+
5
+ #ifdef CMARK_GFM_STATIC_DEFINE
6
+ # define CMARK_GFM_EXPORT
7
+ # define CMARK_GFM_NO_EXPORT
8
+ #else
9
+ # ifndef CMARK_GFM_EXPORT
10
+ # ifdef libcmark_gfm_EXPORTS
11
+ /* We are building this library */
12
+ # define CMARK_GFM_EXPORT __attribute__((visibility("default")))
13
+ # else
14
+ /* We are using this library */
15
+ # define CMARK_GFM_EXPORT __attribute__((visibility("default")))
16
+ # endif
17
+ # endif
18
+
19
+ # ifndef CMARK_GFM_NO_EXPORT
20
+ # define CMARK_GFM_NO_EXPORT __attribute__((visibility("hidden")))
21
+ # endif
22
+ #endif
23
+
24
+ #ifndef CMARK_GFM_DEPRECATED
25
+ # define CMARK_GFM_DEPRECATED __attribute__ ((__deprecated__))
26
+ #endif
27
+
28
+ #ifndef CMARK_GFM_DEPRECATED_EXPORT
29
+ # define CMARK_GFM_DEPRECATED_EXPORT CMARK_GFM_EXPORT CMARK_GFM_DEPRECATED
30
+ #endif
31
+
32
+ #ifndef CMARK_GFM_DEPRECATED_NO_EXPORT
33
+ # define CMARK_GFM_DEPRECATED_NO_EXPORT CMARK_GFM_NO_EXPORT CMARK_GFM_DEPRECATED
34
+ #endif
35
+
36
+ #if 0 /* DEFINE_NO_DEPRECATED */
37
+ # ifndef CMARK_GFM_NO_DEPRECATED
38
+ # define CMARK_GFM_NO_DEPRECATED
39
+ # endif
40
+ #endif
41
+
42
+ #endif /* CMARK_GFM_EXPORT_H */
@@ -0,0 +1,7 @@
1
+ #ifndef CMARK_GFM_VERSION_H
2
+ #define CMARK_GFM_VERSION_H
3
+
4
+ #define CMARK_GFM_VERSION ((0 << 24) | (28 << 16) | (3 << 8) | 18)
5
+ #define CMARK_GFM_VERSION_STRING "0.28.3.gfm.18"
6
+
7
+ #endif