aboutsummaryrefslogtreecommitdiff
path: root/src/node.h
blob: 74eddd4828c528f389c4bcd69c4fe617cef73a9f (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. void *user_data;
  43. int start_line;
  44. int start_column;
  45. int end_line;
  46. int end_column;
  47. bool open;
  48. bool last_line_blank;
  49. cmark_strbuf string_content;
  50. union {
  51. cmark_chunk literal;
  52. cmark_list list;
  53. cmark_code code;
  54. cmark_header header;
  55. cmark_link link;
  56. } as;
  57. };
  58. CMARK_EXPORT int
  59. cmark_node_check(cmark_node *node, FILE *out);
  60. #ifdef __cplusplus
  61. }
  62. #endif
  63. #endif