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