aboutsummaryrefslogtreecommitdiff
path: root/lib/cmark/src/node.h
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-09 18:27:38 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-09 18:27:38 +0200
commitde8fd9328e9deb0d1ec596d7486686ea3cb688c2 (patch)
tree9c25d7568dee522c1d2ed7b6d238d1dad54163f6 /lib/cmark/src/node.h
parent661ddc244793102ee0720871c4edcd64f80bc744 (diff)
downloadkristall-de8fd9328e9deb0d1ec596d7486686ea3cb688c2.tar.gz
Includes cmark markdown parser library.
Diffstat (limited to 'lib/cmark/src/node.h')
-rw-r--r--lib/cmark/src/node.h92
1 files changed, 92 insertions, 0 deletions
diff --git a/lib/cmark/src/node.h b/lib/cmark/src/node.h
new file mode 100644
index 0000000..6bf6677
--- /dev/null
+++ b/lib/cmark/src/node.h
@@ -0,0 +1,92 @@
+#ifndef CMARK_NODE_H
+#define CMARK_NODE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdio.h>
+#include <stdint.h>
+
+#include "config.h"
+#include "cmark.h"
+#include "buffer.h"
+
+typedef struct {
+ int marker_offset;
+ int padding;
+ int start;
+ unsigned char list_type;
+ unsigned char delimiter;
+ unsigned char bullet_char;
+ bool tight;
+} cmark_list;
+
+typedef struct {
+ unsigned char *info;
+ uint8_t fence_length;
+ uint8_t fence_offset;
+ unsigned char fence_char;
+ int8_t fenced;
+} cmark_code;
+
+typedef struct {
+ int level;
+ bool setext;
+} cmark_heading;
+
+typedef struct {
+ unsigned char *url;
+ unsigned char *title;
+} cmark_link;
+
+typedef struct {
+ unsigned char *on_enter;
+ unsigned char *on_exit;
+} cmark_custom;
+
+enum cmark_node__internal_flags {
+ CMARK_NODE__OPEN = (1 << 0),
+ CMARK_NODE__LAST_LINE_BLANK = (1 << 1),
+ CMARK_NODE__LAST_LINE_CHECKED = (1 << 2),
+};
+
+struct cmark_node {
+ cmark_mem *mem;
+
+ struct cmark_node *next;
+ struct cmark_node *prev;
+ struct cmark_node *parent;
+ struct cmark_node *first_child;
+ struct cmark_node *last_child;
+
+ void *user_data;
+
+ unsigned char *data;
+ bufsize_t len;
+
+ int start_line;
+ int start_column;
+ int end_line;
+ int end_column;
+ int internal_offset;
+ uint16_t type;
+ uint16_t flags;
+
+ union {
+ cmark_list list;
+ cmark_code code;
+ cmark_heading heading;
+ cmark_link link;
+ cmark_custom custom;
+ int html_block_type;
+ } as;
+};
+
+CMARK_EXPORT int cmark_node_check(cmark_node *node, FILE *out);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif