cmark

My personal build of CMark ✏️

Commit
b3a96dc9f5f8896ce3341da9029c844afb5c5209
Parent
5a26ca5cf9481289ad77d6049b55c48feea7cc38
Author
John MacFarlane <fiddlosopher@gmail.com>
Date

Moved inline/block-making functions to ast.h.

Now we no longer depend on buffer.h or chunk.h in the public API.

Install cmark.h and cmark_export.h into PREFIX/include instead of PREFIX/include/cmark.

Diffstat

3 files changed, 36 insertions, 40 deletions

Status File Name N° Changes Insertions Deletions
Modified src/CMakeLists.txt 4 2 2
Modified src/ast.h 33 33 0
Modified src/cmark.h 39 1 38
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
@@ -89,8 +89,8 @@ install(TARGETS ${PROGRAM} ${LIBRARY}
   LIBRARY DESTINATION lib
   )
 
-install(FILES cmark.h chunk.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
-  DESTINATION include/${PROJECT_NAME}
+install(FILES cmark.h ${CMAKE_CURRENT_BINARY_DIR}/cmark_export.h
+  DESTINATION include
   )
 
 include (CheckIncludeFile)
diff --git a/src/ast.h b/src/ast.h
@@ -128,6 +128,27 @@ struct cmark_doc_parser {
 	cmark_strbuf *curline;
 };
 
+struct cmark_node_inl *cmark_make_link(struct cmark_node_inl *label, unsigned char *url, unsigned char *title);
+
+struct cmark_node_inl* cmark_make_autolink(struct cmark_node_inl* label, cmark_chunk url, int is_email);
+
+struct cmark_node_inl* cmark_make_inlines(int t, struct cmark_node_inl* contents);
+
+struct cmark_node_inl* cmark_make_literal(int t, cmark_chunk s);
+
+struct cmark_node_inl* cmark_make_simple(int t);
+
+// Macros for creating various kinds of simple.
+#define cmark_make_str(s) cmark_make_literal(INL_STRING, s)
+#define cmark_make_code(s) cmark_make_literal(INL_CODE, s)
+#define cmark_make_raw_html(s) cmark_make_literal(INL_RAW_HTML, s)
+#define cmark_make_linebreak() cmark_make_simple(INL_LINEBREAK)
+#define cmark_make_softbreak() cmark_make_simple(INL_SOFTBREAK)
+#define cmark_make_emph(contents) cmark_make_inlines(INL_EMPH, contents)
+#define cmark_make_strong(contents) cmark_make_inlines(INL_STRONG, contents)
+
+
+
 #ifndef CMARK_NO_SHORT_NAMES
   #define node_inl                  cmark_node_inl
   #define INL_STRING                CMARK_INL_STRING
@@ -154,6 +175,18 @@ struct cmark_doc_parser {
   #define BLOCK_SETEXT_HEADER       CMARK_BLOCK_SETEXT_HEADER
   #define BLOCK_HRULE               CMARK_BLOCK_HRULE
   #define BLOCK_REFERENCE_DEF       CMARK_BLOCK_REFERENCE_DEF
+  #define make_link                 cmark_make_link
+  #define make_autolink             cmark_make_autolink
+  #define make_str                  cmark_make_str
+  #define make_code                 cmark_make_code
+  #define make_raw_html             cmark_make_raw_html
+  #define make_linebreak            cmark_make_linebreak
+  #define make_softbreak            cmark_make_softbreak
+  #define make_emph                 cmark_make_emph
+  #define make_strong               cmark_make_strong
+  #define make_simple               cmark_make_simple
+  #define make_literal              cmark_make_literal
+  #define make_inlines              cmark_make_inlines
 #endif
 
 #ifdef __cplusplus
diff --git a/src/cmark.h b/src/cmark.h
@@ -3,7 +3,7 @@
 
 #include <stdbool.h>
 #include <stdio.h>
-#include "chunk.h"
+#include "cmark_export.h"
 
 #ifdef __cplusplus
 extern "C" {
@@ -53,31 +53,6 @@ void cmark_free_blocks(cmark_node_block *e);
 CMARK_EXPORT
 void cmark_free_inlines(cmark_node_inl* e);
 
-CMARK_EXPORT
-cmark_node_inl *cmark_make_link(cmark_node_inl *label, unsigned char *url, unsigned char *title);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_autolink(cmark_node_inl* label, cmark_chunk url, int is_email);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_inlines(int t, cmark_node_inl* contents);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_literal(int t, cmark_chunk s);
-
-CMARK_EXPORT
-cmark_node_inl* cmark_make_simple(int t);
-
-// Macros for creating various kinds of simple.
-#define cmark_make_str(s) cmark_make_literal(INL_STRING, s)
-#define cmark_make_code(s) cmark_make_literal(INL_CODE, s)
-#define cmark_make_raw_html(s) cmark_make_literal(INL_RAW_HTML, s)
-#define cmark_make_linebreak() cmark_make_simple(INL_LINEBREAK)
-#define cmark_make_softbreak() cmark_make_simple(INL_SOFTBREAK)
-#define cmark_make_emph(contents) cmark_make_inlines(INL_EMPH, contents)
-#define cmark_make_strong(contents) cmark_make_inlines(INL_STRONG, contents)
-
-
 #ifndef CMARK_NO_SHORT_NAMES
   #define VERSION                   CMARK_VERSION
   #define CODE_INDENT               CMARK_CODE_INDENT
@@ -109,18 +84,6 @@ cmark_node_inl* cmark_make_simple(int t);
   #define BLOCK_REFERENCE_DEF       CMARK_BLOCK_REFERENCE_DEF
   #define free_simple               cmark_free_simple
   #define free_blocks               cmark_free_blocks
-  #define make_link                 cmark_make_link
-  #define make_autolink             cmark_make_autolink
-  #define make_str                  cmark_make_str
-  #define make_code                 cmark_make_code
-  #define make_raw_html             cmark_make_raw_html
-  #define make_linebreak            cmark_make_linebreak
-  #define make_softbreak            cmark_make_softbreak
-  #define make_emph                 cmark_make_emph
-  #define make_strong               cmark_make_strong
-  #define make_simple               cmark_make_simple
-  #define make_literal              cmark_make_literal
-  #define make_inlines              cmark_make_inlines
   #define doc_parser                cmark_doc_parser
   #define new_doc_parser            cmark_new_doc_parser
   #define free_doc_parser           cmark_free_doc_parser