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