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