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