aboutsummaryrefslogtreecommitdiff
path: root/src/cmark.h
blob: f87044a06e6d381419f03e444ef30e07c3cae938 (plain)
  1. #ifndef CMARK_H
  2. #define CMARK_H
  3. #include <stdio.h>
  4. #include "cmark_export.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. #define CMARK_VERSION "0.1"
  9. #define CMARK_CODE_INDENT 4
  10. #define CMARK_MAX_LINK_LABEL_LENGTH 1000
  11. typedef struct cmark_node_inl cmark_node_inl;
  12. typedef struct cmark_node_block cmark_node_block;
  13. typedef struct cmark_doc_parser cmark_doc_parser;
  14. CMARK_EXPORT
  15. cmark_doc_parser *cmark_new_doc_parser();
  16. CMARK_EXPORT
  17. void cmark_free_doc_parser(cmark_doc_parser *parser);
  18. CMARK_EXPORT
  19. cmark_node_block *cmark_finish(cmark_doc_parser *parser);
  20. CMARK_EXPORT
  21. void cmark_process_line(cmark_doc_parser *parser, const unsigned char *buffer, size_t bytes);
  22. CMARK_EXPORT
  23. cmark_node_block *cmark_finish(cmark_doc_parser *parser);
  24. CMARK_EXPORT
  25. cmark_node_block *cmark_parse_document(const unsigned char *buffer, size_t len);
  26. CMARK_EXPORT
  27. cmark_node_block *cmark_parse_file(FILE *f);
  28. CMARK_EXPORT
  29. void cmark_debug_print(cmark_node_block *root);
  30. CMARK_EXPORT
  31. unsigned char *cmark_render_html(cmark_node_block *root);
  32. CMARK_EXPORT
  33. unsigned char *cmark_markdown_to_html(unsigned char *text, int len);
  34. CMARK_EXPORT
  35. void cmark_free_blocks(cmark_node_block *e);
  36. CMARK_EXPORT
  37. void cmark_free_inlines(cmark_node_inl* e);
  38. #ifndef CMARK_NO_SHORT_NAMES
  39. #define VERSION CMARK_VERSION
  40. #define CODE_INDENT CMARK_CODE_INDENT
  41. #define MAX_LINK_LABEL_LENGTH CMARK_MAX_LINK_LABEL_LENGTH
  42. #define node_inl cmark_node_inl
  43. #define INL_STRING CMARK_INL_STRING
  44. #define INL_SOFTBREAK CMARK_INL_SOFTBREAK
  45. #define INL_LINEBREAK CMARK_INL_LINEBREAK
  46. #define INL_CODE CMARK_INL_CODE
  47. #define INL_RAW_HTML CMARK_INL_RAW_HTML
  48. #define INL_EMPH CMARK_INL_EMPH
  49. #define INL_STRONG CMARK_INL_STRONG
  50. #define INL_LINK CMARK_INL_LINK
  51. #define INL_IMAGE CMARK_INL_IMAGE
  52. #define ListData cmark_ListData
  53. #define FencedCodeData cmark_FencedCodeData
  54. #define node_block cmark_node_block
  55. #define BLOCK_DOCUMENT CMARK_BLOCK_DOCUMENT
  56. #define BLOCK_BQUOTE CMARK_BLOCK_BQUOTE
  57. #define BLOCK_LIST CMARK_BLOCK_LIST
  58. #define BLOCK_LIST_ITEM CMARK_BLOCK_LIST_ITEM
  59. #define BLOCK_FENCED_CODE CMARK_BLOCK_FENCED_CODE
  60. #define BLOCK_INDENTED_CODE CMARK_BLOCK_INDENTED_CODE
  61. #define BLOCK_HTML CMARK_BLOCK_HTML
  62. #define BLOCK_PARAGRAPH CMARK_BLOCK_PARAGRAPH
  63. #define BLOCK_ATX_HEADER CMARK_BLOCK_ATX_HEADER
  64. #define BLOCK_SETEXT_HEADER CMARK_BLOCK_SETEXT_HEADER
  65. #define BLOCK_HRULE CMARK_BLOCK_HRULE
  66. #define BLOCK_REFERENCE_DEF CMARK_BLOCK_REFERENCE_DEF
  67. #define free_simple cmark_free_simple
  68. #define free_blocks cmark_free_blocks
  69. #define doc_parser cmark_doc_parser
  70. #define new_doc_parser cmark_new_doc_parser
  71. #define free_doc_parser cmark_free_doc_parser
  72. #define process_line cmark_process_line
  73. #define finish cmark_finish
  74. #endif
  75. #ifdef __cplusplus
  76. }
  77. #endif
  78. #endif