aboutsummaryrefslogtreecommitdiff
path: root/src/node.h
blob: d1245a517914ef009b27be33c5181289e8b201c6 (plain)
  1. #ifndef CMARK_NODE_H
  2. #define CMARK_NODE_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <stdio.h>
  7. #include "cmark.h"
  8. #include "buffer.h"
  9. #include "chunk.h"
  10. typedef struct {
  11. cmark_list_type list_type;
  12. int marker_offset;
  13. int padding;
  14. int start;
  15. cmark_delim_type delimiter;
  16. unsigned char bullet_char;
  17. bool tight;
  18. } cmark_list;
  19. typedef struct {
  20. int fence_length;
  21. int fence_offset;
  22. unsigned char fence_char;
  23. cmark_strbuf info;
  24. } cmark_fenced_code;
  25. typedef struct {
  26. int level;
  27. } cmark_header;
  28. typedef struct {
  29. unsigned char *url;
  30. unsigned char *title;
  31. } cmark_link;
  32. struct cmark_node {
  33. cmark_node_type type;
  34. struct cmark_node *next;
  35. struct cmark_node *prev;
  36. struct cmark_node *parent;
  37. struct cmark_node *first_child;
  38. struct cmark_node *last_child;
  39. int start_line;
  40. int start_column;
  41. int end_line;
  42. bool open;
  43. bool last_line_blank;
  44. cmark_strbuf string_content;
  45. union {
  46. cmark_chunk literal;
  47. cmark_list list;
  48. cmark_fenced_code code;
  49. cmark_header header;
  50. cmark_link link;
  51. } as;
  52. };
  53. CMARK_EXPORT int
  54. cmark_node_check(cmark_node *node, FILE *out);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #endif