cmark

My personal build of CMark ✏️

render.h (1304B)

 1 #ifndef CMARK_RENDER_H
 2 #define CMARK_RENDER_H
 3 
 4 #ifdef __cplusplus
 5 extern "C" {
 6 #endif
 7 
 8 #include <stdlib.h>
 9 #include "buffer.h"
10 
11 typedef enum { LITERAL, NORMAL, TITLE, URL } cmark_escaping;
12 
13 struct cmark_renderer {
14   int options;
15   cmark_mem *mem;
16   cmark_strbuf *buffer;
17   cmark_strbuf *prefix;
18   int column;
19   int width;
20   int need_cr;
21   bufsize_t last_breakable;
22   bool begin_line;
23   bool begin_content;
24   bool no_linebreaks;
25   bool in_tight_list_item;
26   void (*outc)(struct cmark_renderer *, cmark_escaping, int32_t, unsigned char);
27   void (*cr)(struct cmark_renderer *);
28   void (*blankline)(struct cmark_renderer *);
29   void (*out)(struct cmark_renderer *, const char *, bool, cmark_escaping);
30 };
31 
32 typedef struct cmark_renderer cmark_renderer;
33 
34 void cmark_render_ascii(cmark_renderer *renderer, const char *s);
35 
36 void cmark_render_code_point(cmark_renderer *renderer, uint32_t c);
37 
38 char *cmark_render(cmark_node *root, int options, int width,
39                    void (*outc)(cmark_renderer *, cmark_escaping, int32_t,
40                                 unsigned char),
41                    int (*render_node)(cmark_renderer *renderer,
42                                       cmark_node *node,
43                                       cmark_event_type ev_type, int options));
44 
45 #ifdef __cplusplus
46 }
47 #endif
48 
49 #endif