cmark

My personal build of CMark ✏️

node.h (1537B)

 1 #ifndef CMARK_NODE_H
 2 #define CMARK_NODE_H
 3 
 4 #ifdef __cplusplus
 5 extern "C" {
 6 #endif
 7 
 8 #include <stdio.h>
 9 #include <stdint.h>
10 
11 #include "config.h"
12 #include "cmark.h"
13 #include "buffer.h"
14 
15 typedef struct {
16   int marker_offset;
17   int padding;
18   int start;
19   unsigned char list_type;
20   unsigned char delimiter;
21   unsigned char bullet_char;
22   bool tight;
23 } cmark_list;
24 
25 typedef struct {
26   unsigned char *info;
27   uint8_t fence_length;
28   uint8_t fence_offset;
29   unsigned char fence_char;
30   int8_t fenced;
31 } cmark_code;
32 
33 typedef struct {
34   int level;
35   bool setext;
36 } cmark_heading;
37 
38 typedef struct {
39   unsigned char *url;
40   unsigned char *title;
41 } cmark_link;
42 
43 typedef struct {
44   unsigned char *on_enter;
45   unsigned char *on_exit;
46 } cmark_custom;
47 
48 enum cmark_node__internal_flags {
49   CMARK_NODE__OPEN = (1 << 0),
50   CMARK_NODE__LAST_LINE_BLANK = (1 << 1),
51   CMARK_NODE__LAST_LINE_CHECKED = (1 << 2),
52 };
53 
54 struct cmark_node {
55   cmark_mem *mem;
56 
57   struct cmark_node *next;
58   struct cmark_node *prev;
59   struct cmark_node *parent;
60   struct cmark_node *first_child;
61   struct cmark_node *last_child;
62 
63   void *user_data;
64 
65   unsigned char *data;
66   bufsize_t len;
67 
68   int start_line;
69   int start_column;
70   int end_line;
71   int end_column;
72   int internal_offset;
73   uint16_t type;
74   uint16_t flags;
75 
76   union {
77     cmark_list list;
78     cmark_code code;
79     cmark_heading heading;
80     cmark_link link;
81     cmark_custom custom;
82     int html_block_type;
83   } as;
84 };
85 
86 CMARK_EXPORT int cmark_node_check(cmark_node *node, FILE *out);
87 
88 #ifdef __cplusplus
89 }
90 #endif
91 
92 #endif