commonmarker 0.17.11 → 0.17.12
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of commonmarker might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ext/commonmarker/arena.c +2 -2
- data/ext/commonmarker/autolink.h +3 -3
- data/ext/commonmarker/blocks.c +1 -1
- data/ext/commonmarker/buffer.h +23 -23
- data/ext/commonmarker/chunk.h +1 -1
- data/ext/commonmarker/cmark-gfm-core-extensions.h +25 -0
- data/ext/commonmarker/{cmark_extension_api.h → cmark-gfm-extension_api.h} +67 -67
- data/ext/commonmarker/cmark-gfm-extensions_export.h +42 -0
- data/ext/commonmarker/{cmark.h → cmark-gfm.h} +88 -88
- data/ext/commonmarker/cmark-gfm_export.h +42 -0
- data/ext/commonmarker/cmark-gfm_version.h +7 -0
- data/ext/commonmarker/cmark.c +3 -3
- data/ext/commonmarker/cmark_ctype.h +6 -6
- data/ext/commonmarker/commonmark.c +2 -2
- data/ext/commonmarker/commonmarker.c +5 -5
- data/ext/commonmarker/commonmarker.h +1 -1
- data/ext/commonmarker/core-extensions.c +2 -2
- data/ext/commonmarker/ext_scanners.h +1 -1
- data/ext/commonmarker/footnotes.c +1 -1
- data/ext/commonmarker/houdini.h +6 -6
- data/ext/commonmarker/houdini_href_e.c +2 -2
- data/ext/commonmarker/html.c +1 -1
- data/ext/commonmarker/inlines.c +1 -1
- data/ext/commonmarker/inlines.h +1 -1
- data/ext/commonmarker/iterator.c +1 -1
- data/ext/commonmarker/iterator.h +1 -1
- data/ext/commonmarker/latex.c +1 -1
- data/ext/commonmarker/linked_list.c +1 -1
- data/ext/commonmarker/man.c +1 -1
- data/ext/commonmarker/node.h +4 -4
- data/ext/commonmarker/plugin.h +2 -2
- data/ext/commonmarker/references.c +1 -1
- data/ext/commonmarker/registry.c +1 -1
- data/ext/commonmarker/registry.h +4 -4
- data/ext/commonmarker/render.c +1 -1
- data/ext/commonmarker/scanners.h +1 -1
- data/ext/commonmarker/strikethrough.c +1 -2
- data/ext/commonmarker/strikethrough.h +3 -3
- data/ext/commonmarker/syntax_extension.c +1 -1
- data/ext/commonmarker/syntax_extension.h +2 -2
- data/ext/commonmarker/table.c +10 -5
- data/ext/commonmarker/table.h +3 -3
- data/ext/commonmarker/tagfilter.h +3 -3
- data/ext/commonmarker/utf8.h +6 -6
- data/ext/commonmarker/xml.c +1 -1
- data/lib/commonmarker/renderer/html_renderer.rb +5 -5
- data/lib/commonmarker/version.rb +1 -2
- data/test/test_extensions.rb +3 -1
- metadata +8 -8
- data/ext/commonmarker/cmark_export.h +0 -42
- data/ext/commonmarker/cmark_version.h +0 -8
- data/ext/commonmarker/cmarkextensions_export.h +0 -42
- data/ext/commonmarker/core-extensions.h +0 -25
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
#ifndef CMARK_GFM_EXTENSIONS_EXPORT_H
|
3
|
+
#define CMARK_GFM_EXTENSIONS_EXPORT_H
|
4
|
+
|
5
|
+
#ifdef CMARK_GFM_EXTENSIONS_STATIC_DEFINE
|
6
|
+
# define CMARK_GFM_EXTENSIONS_EXPORT
|
7
|
+
# define CMARK_GFM_EXTENSIONS_NO_EXPORT
|
8
|
+
#else
|
9
|
+
# ifndef CMARK_GFM_EXTENSIONS_EXPORT
|
10
|
+
# ifdef libcmark_gfm_extensions_EXPORTS
|
11
|
+
/* We are building this library */
|
12
|
+
# define CMARK_GFM_EXTENSIONS_EXPORT __attribute__((visibility("default")))
|
13
|
+
# else
|
14
|
+
/* We are using this library */
|
15
|
+
# define CMARK_GFM_EXTENSIONS_EXPORT __attribute__((visibility("default")))
|
16
|
+
# endif
|
17
|
+
# endif
|
18
|
+
|
19
|
+
# ifndef CMARK_GFM_EXTENSIONS_NO_EXPORT
|
20
|
+
# define CMARK_GFM_EXTENSIONS_NO_EXPORT __attribute__((visibility("hidden")))
|
21
|
+
# endif
|
22
|
+
#endif
|
23
|
+
|
24
|
+
#ifndef CMARK_GFM_EXTENSIONS_DEPRECATED
|
25
|
+
# define CMARK_GFM_EXTENSIONS_DEPRECATED __attribute__ ((__deprecated__))
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#ifndef CMARK_GFM_EXTENSIONS_DEPRECATED_EXPORT
|
29
|
+
# define CMARK_GFM_EXTENSIONS_DEPRECATED_EXPORT CMARK_GFM_EXTENSIONS_EXPORT CMARK_GFM_EXTENSIONS_DEPRECATED
|
30
|
+
#endif
|
31
|
+
|
32
|
+
#ifndef CMARK_GFM_EXTENSIONS_DEPRECATED_NO_EXPORT
|
33
|
+
# define CMARK_GFM_EXTENSIONS_DEPRECATED_NO_EXPORT CMARK_GFM_EXTENSIONS_NO_EXPORT CMARK_GFM_EXTENSIONS_DEPRECATED
|
34
|
+
#endif
|
35
|
+
|
36
|
+
#if 0 /* DEFINE_NO_DEPRECATED */
|
37
|
+
# ifndef CMARK_GFM_EXTENSIONS_NO_DEPRECATED
|
38
|
+
# define CMARK_GFM_EXTENSIONS_NO_DEPRECATED
|
39
|
+
# endif
|
40
|
+
#endif
|
41
|
+
|
42
|
+
#endif /* CMARK_GFM_EXTENSIONS_EXPORT_H */
|
@@ -1,10 +1,10 @@
|
|
1
|
-
#ifndef
|
2
|
-
#define
|
1
|
+
#ifndef CMARK_GFM_H
|
2
|
+
#define CMARK_GFM_H
|
3
3
|
|
4
4
|
#include <stdio.h>
|
5
5
|
#include <stdint.h>
|
6
|
-
#include "
|
7
|
-
#include "
|
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
|
-
|
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
|
@@ -109,19 +109,19 @@ typedef struct cmark_mem {
|
|
109
109
|
/** The default memory allocator; uses the system's calloc,
|
110
110
|
* realloc and free.
|
111
111
|
*/
|
112
|
-
|
112
|
+
CMARK_GFM_EXPORT
|
113
113
|
cmark_mem *cmark_get_default_mem_allocator();
|
114
114
|
|
115
115
|
/** An arena allocator; uses system calloc to allocate large
|
116
116
|
* slabs of memory. Memory in these slabs is not reused at all.
|
117
117
|
*/
|
118
|
-
|
118
|
+
CMARK_GFM_EXPORT
|
119
119
|
cmark_mem *cmark_get_arena_mem_allocator();
|
120
120
|
|
121
121
|
/** Resets the arena allocator, quickly returning all used memory
|
122
122
|
* to the operating system.
|
123
123
|
*/
|
124
|
-
|
124
|
+
CMARK_GFM_EXPORT
|
125
125
|
void cmark_arena_reset(void);
|
126
126
|
|
127
127
|
/** Callback for freeing user data with a 'cmark_mem' context.
|
@@ -151,7 +151,7 @@ typedef struct _cmark_llist
|
|
151
151
|
/** Append an element to the linked list, return the possibly modified
|
152
152
|
* head of the list.
|
153
153
|
*/
|
154
|
-
|
154
|
+
CMARK_GFM_EXPORT
|
155
155
|
cmark_llist * cmark_llist_append (cmark_mem * mem,
|
156
156
|
cmark_llist * head,
|
157
157
|
void * data);
|
@@ -159,14 +159,14 @@ cmark_llist * cmark_llist_append (cmark_mem * mem,
|
|
159
159
|
/** Free the list starting with 'head', calling 'free_func' with the
|
160
160
|
* data pointer of each of its elements
|
161
161
|
*/
|
162
|
-
|
162
|
+
CMARK_GFM_EXPORT
|
163
163
|
void cmark_llist_free_full (cmark_mem * mem,
|
164
164
|
cmark_llist * head,
|
165
165
|
cmark_free_func free_func);
|
166
166
|
|
167
167
|
/** Free the list starting with 'head'
|
168
168
|
*/
|
169
|
-
|
169
|
+
CMARK_GFM_EXPORT
|
170
170
|
void cmark_llist_free (cmark_mem * mem,
|
171
171
|
cmark_llist * head);
|
172
172
|
|
@@ -178,18 +178,18 @@ void cmark_llist_free (cmark_mem * mem,
|
|
178
178
|
* other required properties, which it is the caller's responsibility
|
179
179
|
* to assign.
|
180
180
|
*/
|
181
|
-
|
181
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_new(cmark_node_type type);
|
182
182
|
|
183
183
|
/** Same as `cmark_node_new`, but explicitly listing the memory
|
184
184
|
* allocator used to allocate the node. Note: be sure to use the same
|
185
185
|
* allocator for every node in a tree, or bad things can happen.
|
186
186
|
*/
|
187
|
-
|
187
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type,
|
188
188
|
cmark_mem *mem);
|
189
189
|
|
190
190
|
/** Frees the memory allocated for a node and any children.
|
191
191
|
*/
|
192
|
-
|
192
|
+
CMARK_GFM_EXPORT void cmark_node_free(cmark_node *node);
|
193
193
|
|
194
194
|
/**
|
195
195
|
* ## Tree Traversal
|
@@ -198,24 +198,24 @@ CMARK_EXPORT void cmark_node_free(cmark_node *node);
|
|
198
198
|
/** Returns the next node in the sequence after 'node', or NULL if
|
199
199
|
* there is none.
|
200
200
|
*/
|
201
|
-
|
201
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_next(cmark_node *node);
|
202
202
|
|
203
203
|
/** Returns the previous node in the sequence after 'node', or NULL if
|
204
204
|
* there is none.
|
205
205
|
*/
|
206
|
-
|
206
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_previous(cmark_node *node);
|
207
207
|
|
208
208
|
/** Returns the parent of 'node', or NULL if there is none.
|
209
209
|
*/
|
210
|
-
|
210
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_parent(cmark_node *node);
|
211
211
|
|
212
212
|
/** Returns the first child of 'node', or NULL if 'node' has no children.
|
213
213
|
*/
|
214
|
-
|
214
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_first_child(cmark_node *node);
|
215
215
|
|
216
216
|
/** Returns the last child of 'node', or NULL if 'node' has no children.
|
217
217
|
*/
|
218
|
-
|
218
|
+
CMARK_GFM_EXPORT cmark_node *cmark_node_last_child(cmark_node *node);
|
219
219
|
|
220
220
|
/**
|
221
221
|
* ## Iterator
|
@@ -274,40 +274,40 @@ typedef enum {
|
|
274
274
|
* The memory allocated for the iterator should be released using
|
275
275
|
* 'cmark_iter_free' when it is no longer needed.
|
276
276
|
*/
|
277
|
-
|
277
|
+
CMARK_GFM_EXPORT
|
278
278
|
cmark_iter *cmark_iter_new(cmark_node *root);
|
279
279
|
|
280
280
|
/** Frees the memory allocated for an iterator.
|
281
281
|
*/
|
282
|
-
|
282
|
+
CMARK_GFM_EXPORT
|
283
283
|
void cmark_iter_free(cmark_iter *iter);
|
284
284
|
|
285
285
|
/** Advances to the next node and returns the event type (`CMARK_EVENT_ENTER`,
|
286
286
|
* `CMARK_EVENT_EXIT` or `CMARK_EVENT_DONE`).
|
287
287
|
*/
|
288
|
-
|
288
|
+
CMARK_GFM_EXPORT
|
289
289
|
cmark_event_type cmark_iter_next(cmark_iter *iter);
|
290
290
|
|
291
291
|
/** Returns the current node.
|
292
292
|
*/
|
293
|
-
|
293
|
+
CMARK_GFM_EXPORT
|
294
294
|
cmark_node *cmark_iter_get_node(cmark_iter *iter);
|
295
295
|
|
296
296
|
/** Returns the current event type.
|
297
297
|
*/
|
298
|
-
|
298
|
+
CMARK_GFM_EXPORT
|
299
299
|
cmark_event_type cmark_iter_get_event_type(cmark_iter *iter);
|
300
300
|
|
301
301
|
/** Returns the root node.
|
302
302
|
*/
|
303
|
-
|
303
|
+
CMARK_GFM_EXPORT
|
304
304
|
cmark_node *cmark_iter_get_root(cmark_iter *iter);
|
305
305
|
|
306
306
|
/** Resets the iterator so that the current node is 'current' and
|
307
307
|
* the event type is 'event_type'. The new current node must be a
|
308
308
|
* descendant of the root node or the root node itself.
|
309
309
|
*/
|
310
|
-
|
310
|
+
CMARK_GFM_EXPORT
|
311
311
|
void cmark_iter_reset(cmark_iter *iter, cmark_node *current,
|
312
312
|
cmark_event_type event_type);
|
313
313
|
|
@@ -317,42 +317,42 @@ void cmark_iter_reset(cmark_iter *iter, cmark_node *current,
|
|
317
317
|
|
318
318
|
/** Returns the user data of 'node'.
|
319
319
|
*/
|
320
|
-
|
320
|
+
CMARK_GFM_EXPORT void *cmark_node_get_user_data(cmark_node *node);
|
321
321
|
|
322
322
|
/** Sets arbitrary user data for 'node'. Returns 1 on success,
|
323
323
|
* 0 on failure.
|
324
324
|
*/
|
325
|
-
|
325
|
+
CMARK_GFM_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data);
|
326
326
|
|
327
327
|
/** Set free function for user data */
|
328
|
-
|
328
|
+
CMARK_GFM_EXPORT
|
329
329
|
int cmark_node_set_user_data_free_func(cmark_node *node,
|
330
330
|
cmark_free_func free_func);
|
331
331
|
|
332
332
|
/** Returns the type of 'node', or `CMARK_NODE_NONE` on error.
|
333
333
|
*/
|
334
|
-
|
334
|
+
CMARK_GFM_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node);
|
335
335
|
|
336
336
|
/** Like 'cmark_node_get_type', but returns a string representation
|
337
337
|
of the type, or `"<unknown>"`.
|
338
338
|
*/
|
339
|
-
|
339
|
+
CMARK_GFM_EXPORT
|
340
340
|
const char *cmark_node_get_type_string(cmark_node *node);
|
341
341
|
|
342
342
|
/** Returns the string contents of 'node', or an empty
|
343
343
|
string if none is set. Returns NULL if called on a
|
344
344
|
node that does not have string content.
|
345
345
|
*/
|
346
|
-
|
346
|
+
CMARK_GFM_EXPORT const char *cmark_node_get_literal(cmark_node *node);
|
347
347
|
|
348
348
|
/** Sets the string contents of 'node'. Returns 1 on success,
|
349
349
|
* 0 on failure.
|
350
350
|
*/
|
351
|
-
|
351
|
+
CMARK_GFM_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content);
|
352
352
|
|
353
353
|
/** Returns the heading level of 'node', or 0 if 'node' is not a heading.
|
354
354
|
*/
|
355
|
-
|
355
|
+
CMARK_GFM_EXPORT int cmark_node_get_heading_level(cmark_node *node);
|
356
356
|
|
357
357
|
/* For backwards compatibility */
|
358
358
|
#define cmark_node_get_header_level cmark_node_get_heading_level
|
@@ -360,126 +360,126 @@ CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node);
|
|
360
360
|
|
361
361
|
/** Sets the heading level of 'node', returning 1 on success and 0 on error.
|
362
362
|
*/
|
363
|
-
|
363
|
+
CMARK_GFM_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level);
|
364
364
|
|
365
365
|
/** Returns the list type of 'node', or `CMARK_NO_LIST` if 'node'
|
366
366
|
* is not a list.
|
367
367
|
*/
|
368
|
-
|
368
|
+
CMARK_GFM_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node);
|
369
369
|
|
370
370
|
/** Sets the list type of 'node', returning 1 on success and 0 on error.
|
371
371
|
*/
|
372
|
-
|
372
|
+
CMARK_GFM_EXPORT int cmark_node_set_list_type(cmark_node *node,
|
373
373
|
cmark_list_type type);
|
374
374
|
|
375
375
|
/** Returns the list delimiter type of 'node', or `CMARK_NO_DELIM` if 'node'
|
376
376
|
* is not a list.
|
377
377
|
*/
|
378
|
-
|
378
|
+
CMARK_GFM_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node);
|
379
379
|
|
380
380
|
/** Sets the list delimiter type of 'node', returning 1 on success and 0
|
381
381
|
* on error.
|
382
382
|
*/
|
383
|
-
|
383
|
+
CMARK_GFM_EXPORT int cmark_node_set_list_delim(cmark_node *node,
|
384
384
|
cmark_delim_type delim);
|
385
385
|
|
386
386
|
/** Returns starting number of 'node', if it is an ordered list, otherwise 0.
|
387
387
|
*/
|
388
|
-
|
388
|
+
CMARK_GFM_EXPORT int cmark_node_get_list_start(cmark_node *node);
|
389
389
|
|
390
390
|
/** Sets starting number of 'node', if it is an ordered list. Returns 1
|
391
391
|
* on success, 0 on failure.
|
392
392
|
*/
|
393
|
-
|
393
|
+
CMARK_GFM_EXPORT int cmark_node_set_list_start(cmark_node *node, int start);
|
394
394
|
|
395
395
|
/** Returns 1 if 'node' is a tight list, 0 otherwise.
|
396
396
|
*/
|
397
|
-
|
397
|
+
CMARK_GFM_EXPORT int cmark_node_get_list_tight(cmark_node *node);
|
398
398
|
|
399
399
|
/** Sets the "tightness" of a list. Returns 1 on success, 0 on failure.
|
400
400
|
*/
|
401
|
-
|
401
|
+
CMARK_GFM_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight);
|
402
402
|
|
403
403
|
/** Returns the info string from a fenced code block.
|
404
404
|
*/
|
405
|
-
|
405
|
+
CMARK_GFM_EXPORT const char *cmark_node_get_fence_info(cmark_node *node);
|
406
406
|
|
407
407
|
/** Sets the info string in a fenced code block, returning 1 on
|
408
408
|
* success and 0 on failure.
|
409
409
|
*/
|
410
|
-
|
410
|
+
CMARK_GFM_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info);
|
411
411
|
|
412
412
|
/** Sets code blocks fencing details
|
413
413
|
*/
|
414
|
-
|
414
|
+
CMARK_GFM_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced,
|
415
415
|
int length, int offset, char character);
|
416
416
|
|
417
417
|
/** Returns code blocks fencing details
|
418
418
|
*/
|
419
|
-
|
419
|
+
CMARK_GFM_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character);
|
420
420
|
|
421
421
|
/** Returns the URL of a link or image 'node', or an empty string
|
422
422
|
if no URL is set. Returns NULL if called on a node that is
|
423
423
|
not a link or image.
|
424
424
|
*/
|
425
|
-
|
425
|
+
CMARK_GFM_EXPORT const char *cmark_node_get_url(cmark_node *node);
|
426
426
|
|
427
427
|
/** Sets the URL of a link or image 'node'. Returns 1 on success,
|
428
428
|
* 0 on failure.
|
429
429
|
*/
|
430
|
-
|
430
|
+
CMARK_GFM_EXPORT int cmark_node_set_url(cmark_node *node, const char *url);
|
431
431
|
|
432
432
|
/** Returns the title of a link or image 'node', or an empty
|
433
433
|
string if no title is set. Returns NULL if called on a node
|
434
434
|
that is not a link or image.
|
435
435
|
*/
|
436
|
-
|
436
|
+
CMARK_GFM_EXPORT const char *cmark_node_get_title(cmark_node *node);
|
437
437
|
|
438
438
|
/** Sets the title of a link or image 'node'. Returns 1 on success,
|
439
439
|
* 0 on failure.
|
440
440
|
*/
|
441
|
-
|
441
|
+
CMARK_GFM_EXPORT int cmark_node_set_title(cmark_node *node, const char *title);
|
442
442
|
|
443
443
|
/** Returns the literal "on enter" text for a custom 'node', or
|
444
444
|
an empty string if no on_enter is set. Returns NULL if called
|
445
445
|
on a non-custom node.
|
446
446
|
*/
|
447
|
-
|
447
|
+
CMARK_GFM_EXPORT const char *cmark_node_get_on_enter(cmark_node *node);
|
448
448
|
|
449
449
|
/** Sets the literal text to render "on enter" for a custom 'node'.
|
450
450
|
Any children of the node will be rendered after this text.
|
451
451
|
Returns 1 on success 0 on failure.
|
452
452
|
*/
|
453
|
-
|
453
|
+
CMARK_GFM_EXPORT int cmark_node_set_on_enter(cmark_node *node,
|
454
454
|
const char *on_enter);
|
455
455
|
|
456
456
|
/** Returns the literal "on exit" text for a custom 'node', or
|
457
457
|
an empty string if no on_exit is set. Returns NULL if
|
458
458
|
called on a non-custom node.
|
459
459
|
*/
|
460
|
-
|
460
|
+
CMARK_GFM_EXPORT const char *cmark_node_get_on_exit(cmark_node *node);
|
461
461
|
|
462
462
|
/** Sets the literal text to render "on exit" for a custom 'node'.
|
463
463
|
Any children of the node will be rendered before this text.
|
464
464
|
Returns 1 on success 0 on failure.
|
465
465
|
*/
|
466
|
-
|
466
|
+
CMARK_GFM_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit);
|
467
467
|
|
468
468
|
/** Returns the line on which 'node' begins.
|
469
469
|
*/
|
470
|
-
|
470
|
+
CMARK_GFM_EXPORT int cmark_node_get_start_line(cmark_node *node);
|
471
471
|
|
472
472
|
/** Returns the column at which 'node' begins.
|
473
473
|
*/
|
474
|
-
|
474
|
+
CMARK_GFM_EXPORT int cmark_node_get_start_column(cmark_node *node);
|
475
475
|
|
476
476
|
/** Returns the line on which 'node' ends.
|
477
477
|
*/
|
478
|
-
|
478
|
+
CMARK_GFM_EXPORT int cmark_node_get_end_line(cmark_node *node);
|
479
479
|
|
480
480
|
/** Returns the column at which 'node' ends.
|
481
481
|
*/
|
482
|
-
|
482
|
+
CMARK_GFM_EXPORT int cmark_node_get_end_column(cmark_node *node);
|
483
483
|
|
484
484
|
/**
|
485
485
|
* ## Tree Manipulation
|
@@ -488,40 +488,40 @@ CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node);
|
|
488
488
|
/** Unlinks a 'node', removing it from the tree, but not freeing its
|
489
489
|
* memory. (Use 'cmark_node_free' for that.)
|
490
490
|
*/
|
491
|
-
|
491
|
+
CMARK_GFM_EXPORT void cmark_node_unlink(cmark_node *node);
|
492
492
|
|
493
493
|
/** Inserts 'sibling' before 'node'. Returns 1 on success, 0 on failure.
|
494
494
|
*/
|
495
|
-
|
495
|
+
CMARK_GFM_EXPORT int cmark_node_insert_before(cmark_node *node,
|
496
496
|
cmark_node *sibling);
|
497
497
|
|
498
498
|
/** Inserts 'sibling' after 'node'. Returns 1 on success, 0 on failure.
|
499
499
|
*/
|
500
|
-
|
500
|
+
CMARK_GFM_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling);
|
501
501
|
|
502
502
|
/** Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does
|
503
503
|
* not free its memory).
|
504
504
|
* Returns 1 on success, 0 on failure.
|
505
505
|
*/
|
506
|
-
|
506
|
+
CMARK_GFM_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode);
|
507
507
|
|
508
508
|
/** Adds 'child' to the beginning of the children of 'node'.
|
509
509
|
* Returns 1 on success, 0 on failure.
|
510
510
|
*/
|
511
|
-
|
511
|
+
CMARK_GFM_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child);
|
512
512
|
|
513
513
|
/** Adds 'child' to the end of the children of 'node'.
|
514
514
|
* Returns 1 on success, 0 on failure.
|
515
515
|
*/
|
516
|
-
|
516
|
+
CMARK_GFM_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child);
|
517
517
|
|
518
518
|
/** Consolidates adjacent text nodes.
|
519
519
|
*/
|
520
|
-
|
520
|
+
CMARK_GFM_EXPORT void cmark_consolidate_text_nodes(cmark_node *root);
|
521
521
|
|
522
522
|
/** Ensures a node and all its children own their own chunk memory.
|
523
523
|
*/
|
524
|
-
|
524
|
+
CMARK_GFM_EXPORT void cmark_node_own(cmark_node *root);
|
525
525
|
|
526
526
|
/**
|
527
527
|
* ## Parsing
|
@@ -547,27 +547,27 @@ CMARK_EXPORT void cmark_node_own(cmark_node *root);
|
|
547
547
|
|
548
548
|
/** Creates a new parser object.
|
549
549
|
*/
|
550
|
-
|
550
|
+
CMARK_GFM_EXPORT
|
551
551
|
cmark_parser *cmark_parser_new(int options);
|
552
552
|
|
553
553
|
/** Creates a new parser object with the given memory allocator
|
554
554
|
*/
|
555
|
-
|
555
|
+
CMARK_GFM_EXPORT
|
556
556
|
cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem);
|
557
557
|
|
558
558
|
/** Frees memory allocated for a parser object.
|
559
559
|
*/
|
560
|
-
|
560
|
+
CMARK_GFM_EXPORT
|
561
561
|
void cmark_parser_free(cmark_parser *parser);
|
562
562
|
|
563
563
|
/** Feeds a string of length 'len' to 'parser'.
|
564
564
|
*/
|
565
|
-
|
565
|
+
CMARK_GFM_EXPORT
|
566
566
|
void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len);
|
567
567
|
|
568
568
|
/** Finish parsing and return a pointer to a tree of nodes.
|
569
569
|
*/
|
570
|
-
|
570
|
+
CMARK_GFM_EXPORT
|
571
571
|
cmark_node *cmark_parser_finish(cmark_parser *parser);
|
572
572
|
|
573
573
|
/** Parse a CommonMark document in 'buffer' of length 'len'.
|
@@ -575,14 +575,14 @@ cmark_node *cmark_parser_finish(cmark_parser *parser);
|
|
575
575
|
* the node tree should be released using 'cmark_node_free'
|
576
576
|
* when it is no longer needed.
|
577
577
|
*/
|
578
|
-
|
578
|
+
CMARK_GFM_EXPORT
|
579
579
|
cmark_node *cmark_parse_document(const char *buffer, size_t len, int options);
|
580
580
|
|
581
581
|
/** Parse a CommonMark document in file 'f', returning a pointer to
|
582
582
|
* a tree of nodes. The memory allocated for the node tree should be
|
583
583
|
* released using 'cmark_node_free' when it is no longer needed.
|
584
584
|
*/
|
585
|
-
|
585
|
+
CMARK_GFM_EXPORT
|
586
586
|
cmark_node *cmark_parse_file(FILE *f, int options);
|
587
587
|
|
588
588
|
/**
|
@@ -592,74 +592,74 @@ cmark_node *cmark_parse_file(FILE *f, int options);
|
|
592
592
|
/** Render a 'node' tree as XML. It is the caller's responsibility
|
593
593
|
* to free the returned buffer.
|
594
594
|
*/
|
595
|
-
|
595
|
+
CMARK_GFM_EXPORT
|
596
596
|
char *cmark_render_xml(cmark_node *root, int options);
|
597
597
|
|
598
598
|
/** As for 'cmark_render_xml', but specifying the allocator to use for
|
599
599
|
* the resulting string.
|
600
600
|
*/
|
601
|
-
|
601
|
+
CMARK_GFM_EXPORT
|
602
602
|
char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem);
|
603
603
|
|
604
604
|
/** Render a 'node' tree as an HTML fragment. It is up to the user
|
605
605
|
* to add an appropriate header and footer. It is the caller's
|
606
606
|
* responsibility to free the returned buffer.
|
607
607
|
*/
|
608
|
-
|
608
|
+
CMARK_GFM_EXPORT
|
609
609
|
char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions);
|
610
610
|
|
611
611
|
/** As for 'cmark_render_html', but specifying the allocator to use for
|
612
612
|
* the resulting string.
|
613
613
|
*/
|
614
|
-
|
614
|
+
CMARK_GFM_EXPORT
|
615
615
|
char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem);
|
616
616
|
|
617
617
|
/** Render a 'node' tree as a groff man page, without the header.
|
618
618
|
* It is the caller's responsibility to free the returned buffer.
|
619
619
|
*/
|
620
|
-
|
620
|
+
CMARK_GFM_EXPORT
|
621
621
|
char *cmark_render_man(cmark_node *root, int options, int width);
|
622
622
|
|
623
623
|
/** As for 'cmark_render_man', but specifying the allocator to use for
|
624
624
|
* the resulting string.
|
625
625
|
*/
|
626
|
-
|
626
|
+
CMARK_GFM_EXPORT
|
627
627
|
char *cmark_render_man_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
|
628
628
|
|
629
629
|
/** Render a 'node' tree as a commonmark document.
|
630
630
|
* It is the caller's responsibility to free the returned buffer.
|
631
631
|
*/
|
632
|
-
|
632
|
+
CMARK_GFM_EXPORT
|
633
633
|
char *cmark_render_commonmark(cmark_node *root, int options, int width);
|
634
634
|
|
635
635
|
/** As for 'cmark_render_commonmark', but specifying the allocator to use for
|
636
636
|
* the resulting string.
|
637
637
|
*/
|
638
|
-
|
638
|
+
CMARK_GFM_EXPORT
|
639
639
|
char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
|
640
640
|
|
641
641
|
/** Render a 'node' tree as a plain text document.
|
642
642
|
* It is the caller's responsibility to free the returned buffer.
|
643
643
|
*/
|
644
|
-
|
644
|
+
CMARK_GFM_EXPORT
|
645
645
|
char *cmark_render_plaintext(cmark_node *root, int options, int width);
|
646
646
|
|
647
647
|
/** As for 'cmark_render_plaintext', but specifying the allocator to use for
|
648
648
|
* the resulting string.
|
649
649
|
*/
|
650
|
-
|
650
|
+
CMARK_GFM_EXPORT
|
651
651
|
char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
|
652
652
|
|
653
653
|
/** Render a 'node' tree as a LaTeX document.
|
654
654
|
* It is the caller's responsibility to free the returned buffer.
|
655
655
|
*/
|
656
|
-
|
656
|
+
CMARK_GFM_EXPORT
|
657
657
|
char *cmark_render_latex(cmark_node *root, int options, int width);
|
658
658
|
|
659
659
|
/** As for 'cmark_render_latex', but specifying the allocator to use for
|
660
660
|
* the resulting string.
|
661
661
|
*/
|
662
|
-
|
662
|
+
CMARK_GFM_EXPORT
|
663
663
|
char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem);
|
664
664
|
|
665
665
|
/**
|
@@ -751,13 +751,13 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar
|
|
751
751
|
*
|
752
752
|
* In hexadecimal format, the number 0x010203 represents version 1.2.3.
|
753
753
|
*/
|
754
|
-
|
754
|
+
CMARK_GFM_EXPORT
|
755
755
|
int cmark_version(void);
|
756
756
|
|
757
757
|
/** The library version string for runtime checks. Also available as
|
758
758
|
* macro CMARK_VERSION_STRING for compile time checks.
|
759
759
|
*/
|
760
|
-
|
760
|
+
CMARK_GFM_EXPORT
|
761
761
|
const char *cmark_version_string(void);
|
762
762
|
|
763
763
|
/** # AUTHORS
|