aboutsummaryrefslogtreecommitdiff
path: root/src/node.h
blob: b842ed80ef3f63bd3ab50370c4be2c2672d117db (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. bool fenced;
  21. int fence_length;
  22. int fence_offset;
  23. unsigned char fence_char;
  24. cmark_strbuf info;
  25. } cmark_code;
  26. typedef struct {
  27. int level;
  28. bool setext;
  29. } cmark_header;
  30. typedef struct {
  31. unsigned char *url;
  32. unsigned char *title;
  33. } cmark_link;
  34. struct cmark_node {
  35. cmark_node_type type;
  36. struct cmark_node *next;
  37. struct cmark_node *prev;
  38. struct cmark_node *parent;
  39. struct cmark_node *first_child;
  40. struct cmark_node *last_child;
  41. int start_line;
  42. int start_column;
  43. int end_line;
  44. bool open;
  45. bool last_line_blank;
  46. cmark_strbuf string_content;
  47. union {
  48. cmark_chunk literal;
  49. cmark_list list;
  50. cmark_code code;
  51. cmark_header header;
  52. cmark_link link;
  53. } as;
  54. };
  55. CMARK_EXPORT int
  56. cmark_node_check(cmark_node *node, FILE *out);
  57. #ifdef __cplusplus
  58. }
  59. #endif
  60. #endif