From 322140091c5d67ffdee545e098a64bb9ac23660a Mon Sep 17 00:00:00 2001 From: Ashe Connor Date: Tue, 21 Aug 2018 11:58:41 +1000 Subject: [PATCH] Normalise header and define names (#109) * cmark -> cmark-gfm in most places * normalize filenames, exports * ensure some more #defines don't conflict --- CMakeLists.txt | 6 +- Makefile | 6 +- Makefile.nmake | 2 +- api_test/CMakeLists.txt | 4 +- api_test/cplusplus.cpp | 2 +- api_test/main.c | 8 +- extensions/CMakeLists.txt | 24 +-- extensions/autolink.h | 6 +- extensions/cmark-gfm-core-extensions.h | 25 +++ extensions/core-extensions.c | 4 +- extensions/core-extensions.h | 25 --- extensions/ext_scanners.h | 2 +- extensions/strikethrough.h | 6 +- extensions/table.c | 6 +- extensions/table.h | 6 +- extensions/tagfilter.h | 6 +- man/make_man_page.py | 4 +- man/man3/cmark-gfm.3 | 2 +- src/CMakeLists.txt | 20 +- src/arena.c | 4 +- src/blocks.c | 2 +- src/buffer.h | 46 ++--- src/chunk.h | 2 +- ...ension_api.h => cmark-gfm-extension_api.h} | 134 ++++++------- src/{cmark.h => cmark-gfm.h} | 176 +++++++++--------- src/cmark-gfm_version.h.in | 7 + src/cmark.c | 6 +- src/cmark_ctype.h | 12 +- src/cmark_version.h.in | 8 - src/commonmark.c | 2 +- src/footnotes.c | 2 +- src/houdini.h | 12 +- src/html.c | 2 +- src/inlines.c | 2 +- src/inlines.h | 2 +- src/iterator.c | 2 +- src/iterator.h | 2 +- src/latex.c | 2 +- src/libcmark-gfm.pc.in | 2 +- src/linked_list.c | 2 +- src/main.c | 12 +- src/man.c | 2 +- src/node.h | 8 +- src/plugin.h | 4 +- src/references.c | 2 +- src/registry.c | 2 +- src/registry.h | 8 +- src/render.c | 2 +- src/scanners.h | 2 +- src/syntax_extension.c | 2 +- src/syntax_extension.h | 4 +- src/utf8.h | 12 +- src/xml.c | 2 +- test/cmark-fuzz.c | 2 +- test/cmark.py | 6 +- wrappers/wrapper_ext.py | 12 +- 56 files changed, 337 insertions(+), 338 deletions(-) create mode 100644 extensions/cmark-gfm-core-extensions.h delete mode 100644 extensions/core-extensions.h rename src/{cmark_extension_api.h => cmark-gfm-extension_api.h} (94%) rename src/{cmark.h => cmark-gfm.h} (83%) create mode 100644 src/cmark-gfm_version.h.in delete mode 100644 src/cmark_version.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 8a151c985..3224b29a9 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,7 +6,7 @@ if(CMAKE_MAJOR_VERSION GREATER 2) cmake_policy(SET CMP0048 OLD) endif() -project(cmark) +project(cmark-gfm) include("FindAsan.cmake") @@ -14,7 +14,7 @@ if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") message(FATAL_ERROR "Do not build in-source.\nPlease remove CMakeCache.txt and the CMakeFiles/ directory.\nThen: mkdir build ; cd build ; cmake .. ; make") endif() -set(PROJECT_NAME "cmark") +set(PROJECT_NAME "cmark-gfm") set(PROJECT_VERSION_MAJOR 0) set(PROJECT_VERSION_MINOR 28) @@ -22,7 +22,7 @@ set(PROJECT_VERSION_PATCH 3) set(PROJECT_VERSION_GFM 14) set(PROJECT_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM} ) -option(CMARK_TESTS "Build cmark tests and enable testing" ON) +option(CMARK_TESTS "Build cmark-gfm tests and enable testing" ON) option(CMARK_STATIC "Build static libcmark-gfm library" ON) option(CMARK_SHARED "Build shared libcmark-gfm library" ON) option(CMARK_LIB_FUZZER "Build libFuzzer fuzzing harness" OFF) diff --git a/Makefile b/Makefile index 51a2c1967..85cfd9fb7 100644 --- a/Makefile +++ b/Makefile @@ -101,7 +101,7 @@ mingw: cmake .. -DCMAKE_TOOLCHAIN_FILE=../toolchain-mingw32.cmake -DCMAKE_INSTALL_PREFIX=$(MINGW_INSTALLDIR) ;\ $(MAKE) && $(MAKE) install -man/man3/cmark-gfm.3: src/cmark.h | $(CMARK) +man/man3/cmark-gfm.3: src/cmark-gfm.h | $(CMARK) python man/make_man_page.py $< > $@ \ archive: @@ -222,5 +222,5 @@ distclean: clean -rm -rf $(BENCHFILE) $(ALLTESTS) progit docker: - docker build -t cmark $(CURDIR)/tools - docker run --privileged -t -i -v $(CURDIR):/src/cmark -w /src/cmark cmark /bin/bash + docker build -t cmark-gfm $(CURDIR)/tools + docker run --privileged -t -i -v $(CURDIR):/src/cmark-gfm -w /src/cmark-gfm cmark-gfm /bin/bash diff --git a/Makefile.nmake b/Makefile.nmake index cb35b3df7..80ba4f16d 100644 --- a/Makefile.nmake +++ b/Makefile.nmake @@ -3,7 +3,7 @@ DATADIR=data BUILDDIR=build INSTALLDIR=windows SPEC=test/spec.txt -PROG=$(BUILDDIR)\src\cmark.exe +PROG=$(BUILDDIR)\src\cmark-gfm.exe GENERATOR=NMake Makefiles all: $(BUILDDIR)/CMakeFiles diff --git a/api_test/CMakeLists.txt b/api_test/CMakeLists.txt index da1149849..c5e660996 100644 --- a/api_test/CMakeLists.txt +++ b/api_test/CMakeLists.txt @@ -10,9 +10,9 @@ include_directories( ${PROJECT_BINARY_DIR}/extensions ) if(CMARK_SHARED) - target_link_libraries(api_test libcmark-gfmextensions libcmark-gfm) + target_link_libraries(api_test libcmark-gfm-extensions libcmark-gfm) else() - target_link_libraries(api_test libcmark-gfmextensions_static libcmark-gfm_static) + target_link_libraries(api_test libcmark-gfm-extensions_static libcmark-gfm_static) endif() # Compiler flags diff --git a/api_test/cplusplus.cpp b/api_test/cplusplus.cpp index 5e8f722a3..480c75708 100644 --- a/api_test/cplusplus.cpp +++ b/api_test/cplusplus.cpp @@ -1,6 +1,6 @@ #include -#include "cmark.h" +#include "cmark-gfm.h" #include "cplusplus.h" #include "harness.h" diff --git a/api_test/main.c b/api_test/main.c index d27e7cfad..4151000df 100644 --- a/api_test/main.c +++ b/api_test/main.c @@ -3,9 +3,9 @@ #include #define CMARK_NO_SHORT_NAMES -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" -#include "../extensions/core-extensions.h" +#include "../extensions/cmark-gfm-core-extensions.h" #include "harness.h" #include "cplusplus.h" @@ -36,8 +36,8 @@ static void test_incomplete_char(test_batch_runner *runner, const char *utf8, static void test_continuation_byte(test_batch_runner *runner, const char *utf8); static void version(test_batch_runner *runner) { - INT_EQ(runner, cmark_version(), CMARK_VERSION, "cmark_version"); - STR_EQ(runner, cmark_version_string(), CMARK_VERSION_STRING, + INT_EQ(runner, cmark_version(), CMARK_GFM_VERSION, "cmark_version"); + STR_EQ(runner, cmark_version_string(), CMARK_GFM_VERSION_STRING, "cmark_version_string"); } diff --git a/extensions/CMakeLists.txt b/extensions/CMakeLists.txt index 4c2a57a5e..87d70acc4 100644 --- a/extensions/CMakeLists.txt +++ b/extensions/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 2.8) -set(LIBRARY "libcmark-gfmextensions") -set(STATICLIBRARY "libcmark-gfmextensions_static") +set(LIBRARY "libcmark-gfm-extensions") +set(STATICLIBRARY "libcmark-gfm-extensions_static") set(LIBRARY_SOURCES core-extensions.c table.c @@ -29,7 +29,7 @@ if (CMARK_SHARED) add_library(${LIBRARY} SHARED ${LIBRARY_SOURCES}) set_target_properties(${LIBRARY} PROPERTIES - OUTPUT_NAME "cmark-gfmextensions" + OUTPUT_NAME "cmark-gfm-extensions" SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}.gfm.${PROJECT_VERSION_GFM} VERSION ${PROJECT_VERSION}) @@ -37,10 +37,10 @@ if (CMARK_SHARED) APPEND PROPERTY MACOSX_RPATH true) # Avoid name clash between PROGRAM and LIBRARY pdb files. - set_target_properties(${LIBRARY} PROPERTIES PDB_NAME cmark-gfmextensions_dll) + set_target_properties(${LIBRARY} PROPERTIES PDB_NAME cmark-gfm-extensions_dll) generate_export_header(${LIBRARY} - BASE_NAME cmarkextensions) + BASE_NAME cmark-gfm-extensions) list(APPEND CMARK_INSTALL ${LIBRARY}) target_link_libraries(${LIBRARY} libcmark-gfm) @@ -56,17 +56,17 @@ if (CMARK_STATIC) if (MSVC) set_target_properties(${STATICLIBRARY} PROPERTIES - OUTPUT_NAME "cmark-gfmextensions_static" + OUTPUT_NAME "cmark-gfm-extensions_static" VERSION ${PROJECT_VERSION}) else() set_target_properties(${STATICLIBRARY} PROPERTIES - OUTPUT_NAME "cmark-gfmextensions" + OUTPUT_NAME "cmark-gfm-extensions" VERSION ${PROJECT_VERSION}) endif(MSVC) if (NOT CMARK_SHARED) generate_export_header(${STATICLIBRARY} - BASE_NAME cmarkextensions) + BASE_NAME cmark-gfm-extensions) endif() list(APPEND CMARK_INSTALL ${STATICLIBRARY}) @@ -76,7 +76,7 @@ set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS ON) include (InstallRequiredSystemLibraries) install(TARGETS ${CMARK_INSTALL} - EXPORT cmark-gfmextensions + EXPORT cmark-gfm-extensions RUNTIME DESTINATION bin LIBRARY DESTINATION lib${LIB_SUFFIX} ARCHIVE DESTINATION lib${LIB_SUFFIX} @@ -84,12 +84,12 @@ install(TARGETS ${CMARK_INSTALL} if (CMARK_SHARED OR CMARK_STATIC) install(FILES - core-extensions.h - ${CMAKE_CURRENT_BINARY_DIR}/cmarkextensions_export.h + cmark-gfm-core-extensions.h + ${CMAKE_CURRENT_BINARY_DIR}/cmark-gfm-extensions_export.h DESTINATION include ) - install(EXPORT cmark-gfmextensions DESTINATION lib${LIB_SUFFIX}/cmake-gfmextensions) + install(EXPORT cmark-gfm-extensions DESTINATION lib${LIB_SUFFIX}/cmake-gfm-extensions) endif() # Feature tests diff --git a/extensions/autolink.h b/extensions/autolink.h index ee2ea2ffc..4e179379d 100644 --- a/extensions/autolink.h +++ b/extensions/autolink.h @@ -1,7 +1,7 @@ -#ifndef AUTOLINK_H -#define AUTOLINK_H +#ifndef CMARK_GFM_AUTOLINK_H +#define CMARK_GFM_AUTOLINK_H -#include "core-extensions.h" +#include "cmark-gfm-core-extensions.h" cmark_syntax_extension *create_autolink_extension(void); diff --git a/extensions/cmark-gfm-core-extensions.h b/extensions/cmark-gfm-core-extensions.h new file mode 100644 index 000000000..075905e82 --- /dev/null +++ b/extensions/cmark-gfm-core-extensions.h @@ -0,0 +1,25 @@ +#ifndef CMARK_GFM_CORE_EXTENSIONS_H +#define CMARK_GFM_CORE_EXTENSIONS_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "cmark-gfm-extension_api.h" +#include "cmark-gfm-extensions_export.h" +#include + +CMARK_GFM_EXTENSIONS_EXPORT +void cmark_gfm_core_extensions_ensure_registered(void); + +CMARK_GFM_EXTENSIONS_EXPORT +uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node); + +CMARK_GFM_EXTENSIONS_EXPORT +uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/extensions/core-extensions.c b/extensions/core-extensions.c index 4659ab177..e436a5d15 100644 --- a/extensions/core-extensions.c +++ b/extensions/core-extensions.c @@ -1,4 +1,4 @@ -#include "core-extensions.h" +#include "cmark-gfm-core-extensions.h" #include "autolink.h" #include "strikethrough.h" #include "table.h" @@ -15,7 +15,7 @@ static int core_extensions_registration(cmark_plugin *plugin) { return 1; } -void core_extensions_ensure_registered(void) { +void cmark_gfm_core_extensions_ensure_registered(void) { static int registered = 0; if (!registered) { diff --git a/extensions/core-extensions.h b/extensions/core-extensions.h deleted file mode 100644 index a9fd0cb28..000000000 --- a/extensions/core-extensions.h +++ /dev/null @@ -1,25 +0,0 @@ -#ifndef CORE_EXTENSIONS_H -#define CORE_EXTENSIONS_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "cmark_extension_api.h" -#include "cmarkextensions_export.h" -#include - -CMARKEXTENSIONS_EXPORT -void core_extensions_ensure_registered(void); - -CMARKEXTENSIONS_EXPORT -uint16_t cmarkextensions_get_table_columns(cmark_node *node); - -CMARKEXTENSIONS_EXPORT -uint8_t *cmarkextensions_get_table_alignments(cmark_node *node); - -#ifdef __cplusplus -} -#endif - -#endif diff --git a/extensions/ext_scanners.h b/extensions/ext_scanners.h index 53584d891..3bfe586c1 100644 --- a/extensions/ext_scanners.h +++ b/extensions/ext_scanners.h @@ -1,5 +1,5 @@ #include "chunk.h" -#include "cmark.h" +#include "cmark-gfm.h" #ifdef __cplusplus extern "C" { diff --git a/extensions/strikethrough.h b/extensions/strikethrough.h index 1c43f5792..a52a2b4ac 100644 --- a/extensions/strikethrough.h +++ b/extensions/strikethrough.h @@ -1,7 +1,7 @@ -#ifndef STRIKETHROUGH_H -#define STRIKETHROUGH_H +#ifndef CMARK_GFM_STRIKETHROUGH_H +#define CMARK_GFM_STRIKETHROUGH_H -#include "core-extensions.h" +#include "cmark-gfm-core-extensions.h" extern cmark_node_type CMARK_NODE_STRIKETHROUGH; cmark_syntax_extension *create_strikethrough_extension(void); diff --git a/extensions/table.c b/extensions/table.c index e955b0d6d..1d675e04d 100644 --- a/extensions/table.c +++ b/extensions/table.c @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -685,14 +685,14 @@ cmark_syntax_extension *create_table_extension(void) { return self; } -uint16_t cmarkextensions_get_table_columns(cmark_node *node) { +uint16_t cmark_gfm_extensions_get_table_columns(cmark_node *node) { if (node->type != CMARK_NODE_TABLE) return 0; return ((node_table *)node->as.opaque)->n_columns; } -uint8_t *cmarkextensions_get_table_alignments(cmark_node *node) { +uint8_t *cmark_gfm_extensions_get_table_alignments(cmark_node *node) { if (node->type != CMARK_NODE_TABLE) return 0; diff --git a/extensions/table.h b/extensions/table.h index 85bb1a4c7..f6a0634f0 100644 --- a/extensions/table.h +++ b/extensions/table.h @@ -1,7 +1,7 @@ -#ifndef TABLE_H -#define TABLE_H +#ifndef CMARK_GFM_TABLE_H +#define CMARK_GFM_TABLE_H -#include "core-extensions.h" +#include "cmark-gfm-core-extensions.h" extern cmark_node_type CMARK_NODE_TABLE, CMARK_NODE_TABLE_ROW, diff --git a/extensions/tagfilter.h b/extensions/tagfilter.h index 4068b5071..9a5f388d4 100644 --- a/extensions/tagfilter.h +++ b/extensions/tagfilter.h @@ -1,7 +1,7 @@ -#ifndef TAGFILTER_H -#define TAGFILTER_H +#ifndef CMARK_GFM_TAGFILTER_H +#define CMARK_GFM_TAGFILTER_H -#include "core-extensions.h" +#include "cmark-gfm-core-extensions.h" cmark_syntax_extension *create_tagfilter_extension(void); diff --git a/man/make_man_page.py b/man/make_man_page.py index a37818be1..d95620252 100644 --- a/man/make_man_page.py +++ b/man/make_man_page.py @@ -46,9 +46,9 @@ def md2man(text): comment_start_re = re.compile('^\/\*\* ?') comment_delim_re = re.compile('^[/ ]\** ?') comment_end_re = re.compile('^ \**\/') -function_re = re.compile('^ *(?:CMARK_EXPORT\s+)?(?P(?:const\s+)?\w+(?:\s*[*])?)\s*(?P\w+)\s*\((?P[^)]*)\)') +function_re = re.compile('^ *(?:CMARK_GFM_EXPORT\s+)?(?P(?:const\s+)?\w+(?:\s*[*])?)\s*(?P\w+)\s*\((?P[^)]*)\)') blank_re = re.compile('^\s*$') -macro_re = re.compile('CMARK_EXPORT *') +macro_re = re.compile('CMARK_GFM_EXPORT *') typedef_start_re = re.compile('typedef.*{$') typedef_end_re = re.compile('}') single_quote_re = re.compile("(? #include #include -#include "cmark.h" -#include "cmark_extension_api.h" +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" static struct arena_chunk { size_t sz, used; diff --git a/src/blocks.c b/src/blocks.c index 377cc0e64..97661f3e6 100644 --- a/src/blocks.c +++ b/src/blocks.c @@ -13,7 +13,7 @@ #include "syntax_extension.h" #include "config.h" #include "parser.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "references.h" #include "utf8.h" diff --git a/src/buffer.h b/src/buffer.h index 35af9c390..b85bb4406 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -7,7 +7,7 @@ #include #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #ifdef __cplusplus extern "C" { @@ -30,32 +30,32 @@ extern unsigned char cmark_strbuf__initbuf[]; * For the cases where CMARK_BUF_INIT cannot be used to do static * initialization. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_init(cmark_mem *mem, cmark_strbuf *buf, bufsize_t initial_size); /** * Grow the buffer to hold at least `target_size` bytes. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_grow(cmark_strbuf *buf, bufsize_t target_size); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_free(cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_swap(cmark_strbuf *buf_a, cmark_strbuf *buf_b); -CMARK_EXPORT +CMARK_GFM_EXPORT bufsize_t cmark_strbuf_len(const cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_strbuf_cmp(const cmark_strbuf *a, const cmark_strbuf *b); -CMARK_EXPORT +CMARK_GFM_EXPORT unsigned char *cmark_strbuf_detach(cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_copy_cstr(char *data, bufsize_t datasize, const cmark_strbuf *buf); @@ -65,48 +65,48 @@ static CMARK_INLINE const char *cmark_strbuf_cstr(const cmark_strbuf *buf) { #define cmark_strbuf_at(buf, n) ((buf)->ptr[n]) -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_set(cmark_strbuf *buf, const unsigned char *data, bufsize_t len); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_sets(cmark_strbuf *buf, const char *string); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_putc(cmark_strbuf *buf, int c); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_put(cmark_strbuf *buf, const unsigned char *data, bufsize_t len); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_puts(cmark_strbuf *buf, const char *string); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_clear(cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT bufsize_t cmark_strbuf_strchr(const cmark_strbuf *buf, int c, bufsize_t pos); -CMARK_EXPORT +CMARK_GFM_EXPORT bufsize_t cmark_strbuf_strrchr(const cmark_strbuf *buf, int c, bufsize_t pos); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_drop(cmark_strbuf *buf, bufsize_t n); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_truncate(cmark_strbuf *buf, bufsize_t len); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_rtrim(cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_trim(cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_normalize_whitespace(cmark_strbuf *s); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_strbuf_unescape(cmark_strbuf *s); #ifdef __cplusplus diff --git a/src/chunk.h b/src/chunk.h index c6a68687c..dfed13f19 100644 --- a/src/chunk.h +++ b/src/chunk.h @@ -4,7 +4,7 @@ #include #include #include -#include "cmark.h" +#include "cmark-gfm.h" #include "buffer.h" #include "memory.h" #include "cmark_ctype.h" diff --git a/src/cmark_extension_api.h b/src/cmark-gfm-extension_api.h similarity index 94% rename from src/cmark_extension_api.h rename to src/cmark-gfm-extension_api.h index 57ff229b4..853948c43 100644 --- a/src/cmark_extension_api.h +++ b/src/cmark-gfm-extension_api.h @@ -1,11 +1,11 @@ -#ifndef CMARK_CMARK_EXTENSION_API_H -#define CMARK_CMARK_EXTENSION_API_H +#ifndef CMARK_GFM_EXTENSION_API_H +#define CMARK_GFM_EXTENSION_API_H #ifdef __cplusplus extern "C" { #endif -#include "cmark.h" +#include "cmark-gfm.h" struct cmark_renderer; struct cmark_html_renderer; @@ -170,7 +170,7 @@ typedef int (*cmark_plugin_init_func)(cmark_plugin *plugin); * This takes ownership of 'extension', one should not call * 'cmark_syntax_extension_free' on a registered extension. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_plugin_register_syntax_extension(cmark_plugin *plugin, cmark_syntax_extension *extension); @@ -180,7 +180,7 @@ int cmark_plugin_register_syntax_extension(cmark_plugin *plugin, * It can then be attached to a cmark_parser * with the cmark_parser_attach_syntax_extension method. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_syntax_extension *cmark_find_syntax_extension(const char *name); /** Should create and add a new open block to 'parent_container' if @@ -260,143 +260,143 @@ typedef void (*cmark_opaque_free_func) (cmark_syntax_extension *extension, /** Free a cmark_syntax_extension. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_free (cmark_mem *mem, cmark_syntax_extension *extension); /** Return a newly-constructed cmark_syntax_extension, named 'name'. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_syntax_extension *cmark_syntax_extension_new (const char *name); -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node_type cmark_syntax_extension_add_node(int is_inline); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_emphasis(cmark_syntax_extension *extension, int emphasis); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_open_block_func(cmark_syntax_extension *extension, cmark_open_block_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_match_block_func(cmark_syntax_extension *extension, cmark_match_block_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_match_inline_func(cmark_syntax_extension *extension, cmark_match_inline_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_inline_from_delim_func(cmark_syntax_extension *extension, cmark_inline_from_delim_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_special_inline_chars(cmark_syntax_extension *extension, cmark_llist *special_chars); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_get_type_string_func(cmark_syntax_extension *extension, cmark_get_type_string_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_can_contain_func(cmark_syntax_extension *extension, cmark_can_contain_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_contains_inlines_func(cmark_syntax_extension *extension, cmark_contains_inlines_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_commonmark_render_func(cmark_syntax_extension *extension, cmark_common_render_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_plaintext_render_func(cmark_syntax_extension *extension, cmark_common_render_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_latex_render_func(cmark_syntax_extension *extension, cmark_common_render_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_man_render_func(cmark_syntax_extension *extension, cmark_common_render_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_html_render_func(cmark_syntax_extension *extension, cmark_html_render_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_html_filter_func(cmark_syntax_extension *extension, cmark_html_filter_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_commonmark_escape_func(cmark_syntax_extension *extension, cmark_commonmark_escape_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_private(cmark_syntax_extension *extension, void *priv, cmark_free_func free_func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void *cmark_syntax_extension_get_private(cmark_syntax_extension *extension); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_postprocess_func(cmark_syntax_extension *extension, cmark_postprocess_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_syntax_extension_set_opaque_free_func(cmark_syntax_extension *extension, cmark_opaque_free_func func); /** See the documentation for 'cmark_syntax_extension' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_set_backslash_ispunct_func(cmark_parser *parser, cmark_ispunct_func func); /** Return the index of the line currently being parsed, starting with 1. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_line_number(cmark_parser *parser); /** Return the offset in bytes in the line being processed. @@ -407,7 +407,7 @@ int cmark_parser_get_line_number(cmark_parser *parser); * * Here, offset will first be 0, then 5 (the index of the 'f' character). */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_offset(cmark_parser *parser); /** @@ -441,7 +441,7 @@ int cmark_parser_get_offset(cmark_parser *parser); * cmark_parser_has_partially_consumed_tab() will now return * 'true'. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_column(cmark_parser *parser); /** Return the absolute index in bytes of the first nonspace @@ -456,7 +456,7 @@ int cmark_parser_get_column(cmark_parser *parser); * 0 offset (16) first_nonspace (28) * ``` */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_first_nonspace(cmark_parser *parser); /** Return the absolute index of the first nonspace column coming after 'offset' @@ -466,7 +466,7 @@ int cmark_parser_get_first_nonspace(cmark_parser *parser); * See the documentation for cmark_parser_get_first_nonspace() and * cmark_parser_get_column() for more information. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_first_nonspace_column(cmark_parser *parser); /** Return the difference between the values returned by @@ -476,7 +476,7 @@ int cmark_parser_get_first_nonspace_column(cmark_parser *parser); * This is not a byte offset, as it can count one tab as multiple * characters. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_indent(cmark_parser *parser); /** Return 'true' if the line currently being processed has been entirely @@ -507,7 +507,7 @@ int cmark_parser_get_indent(cmark_parser *parser); * * At this point, this function will now return 'true'. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_is_blank(cmark_parser *parser); /** Return 'true' if the value returned by cmark_parser_get_offset() @@ -516,13 +516,13 @@ int cmark_parser_is_blank(cmark_parser *parser); * See the documentation for cmark_parser_get_column() for more * information. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_has_partially_consumed_tab(cmark_parser *parser); /** Return the length in bytes of the previously processed line, excluding potential * newline (\n) and carriage return (\r) trailing characters. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_get_last_line_length(cmark_parser *parser); /** Add a child to 'parent' during the parsing process. @@ -531,7 +531,7 @@ int cmark_parser_get_last_line_length(cmark_parser *parser); * this function will back up till it hits a node that can, closing * blocks as appropriate. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node*cmark_parser_add_child(cmark_parser *parser, cmark_node *parent, cmark_node_type block_type, @@ -542,14 +542,14 @@ cmark_node*cmark_parser_add_child(cmark_parser *parser, * See the documentation of cmark_parser_get_offset() and * cmark_parser_get_column() for more information. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_advance_offset(cmark_parser *parser, const char *input, int count, int columns); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_feed_reentrant(cmark_parser *parser, const char *buffer, size_t len); /** Attach the syntax 'extension' to the 'parser', to provide extra syntax @@ -559,33 +559,33 @@ void cmark_parser_feed_reentrant(cmark_parser *parser, const char *buffer, size_ * Returns 'true' if the 'extension' was successfully attached, * 'false' otherwise. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_parser_attach_syntax_extension(cmark_parser *parser, cmark_syntax_extension *extension); /** Change the type of 'node'. * * Return 0 if the type could be changed, 1 otherwise. */ -CMARK_EXPORT int cmark_node_set_type(cmark_node *node, cmark_node_type type); +CMARK_GFM_EXPORT int cmark_node_set_type(cmark_node *node, cmark_node_type type); /** Return the string content for all types of 'node'. * The pointer stays valid as long as 'node' isn't freed. */ -CMARK_EXPORT const char *cmark_node_get_string_content(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_string_content(cmark_node *node); /** Set the string 'content' for all types of 'node'. * Copies 'content'. */ -CMARK_EXPORT int cmark_node_set_string_content(cmark_node *node, const char *content); +CMARK_GFM_EXPORT int cmark_node_set_string_content(cmark_node *node, const char *content); /** Get the syntax extension responsible for the creation of 'node'. * Return NULL if 'node' was created because it matched standard syntax rules. */ -CMARK_EXPORT cmark_syntax_extension *cmark_node_get_syntax_extension(cmark_node *node); +CMARK_GFM_EXPORT cmark_syntax_extension *cmark_node_get_syntax_extension(cmark_node *node); /** Set the syntax extension responsible for creating 'node'. */ -CMARK_EXPORT int cmark_node_set_syntax_extension(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_syntax_extension(cmark_node *node, cmark_syntax_extension *extension); /** @@ -600,63 +600,63 @@ CMARK_EXPORT int cmark_node_set_syntax_extension(cmark_node *node, typedef int (*cmark_inline_predicate)(int c); /** Advance the current inline parsing offset */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_inline_parser_advance_offset(cmark_inline_parser *parser); /** Get the current inline parsing offset */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_inline_parser_get_offset(cmark_inline_parser *parser); /** Set the offset in bytes in the chunk being processed by the given inline parser. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_inline_parser_set_offset(cmark_inline_parser *parser, int offset); /** Gets the cmark_chunk being operated on by the given inline parser. * Use cmark_inline_parser_get_offset to get our current position in the chunk. */ -CMARK_EXPORT +CMARK_GFM_EXPORT struct cmark_chunk *cmark_inline_parser_get_chunk(cmark_inline_parser *parser); /** Returns 1 if the inline parser is currently in a bracket; pass 1 for 'image' * if you want to know about an image-type bracket, 0 for link-type. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_inline_parser_in_bracket(cmark_inline_parser *parser, int image); /** Remove the last n characters from the last child of the given node. * This only works where all n characters are in the single last child, and the last * child is CMARK_NODE_TEXT. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_node_unput(cmark_node *node, int n); /** Get the character located at the current inline parsing offset */ -CMARK_EXPORT +CMARK_GFM_EXPORT unsigned char cmark_inline_parser_peek_char(cmark_inline_parser *parser); /** Get the character located 'pos' bytes in the current line. */ -CMARK_EXPORT +CMARK_GFM_EXPORT unsigned char cmark_inline_parser_peek_at(cmark_inline_parser *parser, int pos); /** Whether the inline parser has reached the end of the current line */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_inline_parser_is_eof(cmark_inline_parser *parser); /** Get the characters located after the current inline parsing offset * while 'pred' matches. Free after usage. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_inline_parser_take_while(cmark_inline_parser *parser, cmark_inline_predicate pred); /** Push a delimiter on the delimiter stack. * See < for * more information on the parameters */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_inline_parser_push_delimiter(cmark_inline_parser *parser, unsigned char c, int can_open, @@ -665,16 +665,16 @@ void cmark_inline_parser_push_delimiter(cmark_inline_parser *parser, /** Remove 'delim' from the delimiter stack */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_inline_parser_remove_delimiter(cmark_inline_parser *parser, delimiter *delim); -CMARK_EXPORT +CMARK_GFM_EXPORT delimiter *cmark_inline_parser_get_last_delimiter(cmark_inline_parser *parser); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_inline_parser_get_line(cmark_inline_parser *parser); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_inline_parser_get_column(cmark_inline_parser *parser); /** Convenience function to scan a given delimiter. @@ -691,7 +691,7 @@ int cmark_inline_parser_get_column(cmark_inline_parser *parser); * Returns the number of delimiters encountered, in the limit * of 'max_delims', and advances the inline parsing offset. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_inline_parser_scan_delimiters(cmark_inline_parser *parser, int max_delims, unsigned char c, @@ -700,16 +700,16 @@ int cmark_inline_parser_scan_delimiters(cmark_inline_parser *parser, int *punct_before, int *punct_after); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_manage_extensions_special_characters(cmark_parser *parser, int add); -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_llist *cmark_parser_get_syntax_extensions(cmark_parser *parser); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_arena_push(void); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_arena_pop(void); #ifdef __cplusplus diff --git a/src/cmark.h b/src/cmark-gfm.h similarity index 83% rename from src/cmark.h rename to src/cmark-gfm.h index ef9e4a150..a26f640ef 100644 --- a/src/cmark.h +++ b/src/cmark-gfm.h @@ -1,10 +1,10 @@ -#ifndef CMARK_CMARK_H -#define CMARK_CMARK_H +#ifndef CMARK_GFM_H +#define CMARK_GFM_H #include #include -#include "cmark_export.h" -#include "cmark_version.h" +#include "cmark-gfm_export.h" +#include "cmark-gfm_version.h" #ifdef __cplusplus extern "C" { @@ -25,7 +25,7 @@ extern "C" { * UTF-8-encoded string. It is the caller's responsibility * to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_markdown_to_html(const char *text, size_t len, int options); /** ## Node Structure @@ -109,19 +109,19 @@ typedef struct cmark_mem { /** The default memory allocator; uses the system's calloc, * realloc and free. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_mem *cmark_get_default_mem_allocator(); /** An arena allocator; uses system calloc to allocate large * slabs of memory. Memory in these slabs is not reused at all. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_mem *cmark_get_arena_mem_allocator(); /** Resets the arena allocator, quickly returning all used memory * to the operating system. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_arena_reset(void); /** Callback for freeing user data with a 'cmark_mem' context. @@ -151,7 +151,7 @@ typedef struct _cmark_llist /** Append an element to the linked list, return the possibly modified * head of the list. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_llist * cmark_llist_append (cmark_mem * mem, cmark_llist * head, void * data); @@ -159,14 +159,14 @@ cmark_llist * cmark_llist_append (cmark_mem * mem, /** Free the list starting with 'head', calling 'free_func' with the * data pointer of each of its elements */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_llist_free_full (cmark_mem * mem, cmark_llist * head, cmark_free_func free_func); /** Free the list starting with 'head' */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_llist_free (cmark_mem * mem, cmark_llist * head); @@ -178,18 +178,18 @@ void cmark_llist_free (cmark_mem * mem, * other required properties, which it is the caller's responsibility * to assign. */ -CMARK_EXPORT cmark_node *cmark_node_new(cmark_node_type type); +CMARK_GFM_EXPORT cmark_node *cmark_node_new(cmark_node_type type); /** Same as `cmark_node_new`, but explicitly listing the memory * allocator used to allocate the node. Note: be sure to use the same * allocator for every node in a tree, or bad things can happen. */ -CMARK_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type, +CMARK_GFM_EXPORT cmark_node *cmark_node_new_with_mem(cmark_node_type type, cmark_mem *mem); /** Frees the memory allocated for a node and any children. */ -CMARK_EXPORT void cmark_node_free(cmark_node *node); +CMARK_GFM_EXPORT void cmark_node_free(cmark_node *node); /** * ## Tree Traversal @@ -198,24 +198,24 @@ CMARK_EXPORT void cmark_node_free(cmark_node *node); /** Returns the next node in the sequence after 'node', or NULL if * there is none. */ -CMARK_EXPORT cmark_node *cmark_node_next(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_next(cmark_node *node); /** Returns the previous node in the sequence after 'node', or NULL if * there is none. */ -CMARK_EXPORT cmark_node *cmark_node_previous(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_previous(cmark_node *node); /** Returns the parent of 'node', or NULL if there is none. */ -CMARK_EXPORT cmark_node *cmark_node_parent(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_parent(cmark_node *node); /** Returns the first child of 'node', or NULL if 'node' has no children. */ -CMARK_EXPORT cmark_node *cmark_node_first_child(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_first_child(cmark_node *node); /** Returns the last child of 'node', or NULL if 'node' has no children. */ -CMARK_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); +CMARK_GFM_EXPORT cmark_node *cmark_node_last_child(cmark_node *node); /** * ## Iterator @@ -274,40 +274,40 @@ typedef enum { * The memory allocated for the iterator should be released using * 'cmark_iter_free' when it is no longer needed. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_iter *cmark_iter_new(cmark_node *root); /** Frees the memory allocated for an iterator. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_iter_free(cmark_iter *iter); /** Advances to the next node and returns the event type (`CMARK_EVENT_ENTER`, * `CMARK_EVENT_EXIT` or `CMARK_EVENT_DONE`). */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_event_type cmark_iter_next(cmark_iter *iter); /** Returns the current node. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_iter_get_node(cmark_iter *iter); /** Returns the current event type. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_event_type cmark_iter_get_event_type(cmark_iter *iter); /** Returns the root node. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_iter_get_root(cmark_iter *iter); /** Resets the iterator so that the current node is 'current' and * the event type is 'event_type'. The new current node must be a * descendant of the root node or the root node itself. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_iter_reset(cmark_iter *iter, cmark_node *current, cmark_event_type event_type); @@ -317,42 +317,42 @@ void cmark_iter_reset(cmark_iter *iter, cmark_node *current, /** Returns the user data of 'node'. */ -CMARK_EXPORT void *cmark_node_get_user_data(cmark_node *node); +CMARK_GFM_EXPORT void *cmark_node_get_user_data(cmark_node *node); /** Sets arbitrary user data for 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data); +CMARK_GFM_EXPORT int cmark_node_set_user_data(cmark_node *node, void *user_data); /** Set free function for user data */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_node_set_user_data_free_func(cmark_node *node, cmark_free_func free_func); /** Returns the type of 'node', or `CMARK_NODE_NONE` on error. */ -CMARK_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node); +CMARK_GFM_EXPORT cmark_node_type cmark_node_get_type(cmark_node *node); /** Like 'cmark_node_get_type', but returns a string representation of the type, or `""`. */ -CMARK_EXPORT +CMARK_GFM_EXPORT const char *cmark_node_get_type_string(cmark_node *node); /** Returns the string contents of 'node', or an empty string if none is set. Returns NULL if called on a node that does not have string content. */ -CMARK_EXPORT const char *cmark_node_get_literal(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_literal(cmark_node *node); /** Sets the string contents of 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content); +CMARK_GFM_EXPORT int cmark_node_set_literal(cmark_node *node, const char *content); /** Returns the heading level of 'node', or 0 if 'node' is not a heading. */ -CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_heading_level(cmark_node *node); /* For backwards compatibility */ #define cmark_node_get_header_level cmark_node_get_heading_level @@ -360,126 +360,126 @@ CMARK_EXPORT int cmark_node_get_heading_level(cmark_node *node); /** Sets the heading level of 'node', returning 1 on success and 0 on error. */ -CMARK_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level); +CMARK_GFM_EXPORT int cmark_node_set_heading_level(cmark_node *node, int level); /** Returns the list type of 'node', or `CMARK_NO_LIST` if 'node' * is not a list. */ -CMARK_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node); +CMARK_GFM_EXPORT cmark_list_type cmark_node_get_list_type(cmark_node *node); /** Sets the list type of 'node', returning 1 on success and 0 on error. */ -CMARK_EXPORT int cmark_node_set_list_type(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_list_type(cmark_node *node, cmark_list_type type); /** Returns the list delimiter type of 'node', or `CMARK_NO_DELIM` if 'node' * is not a list. */ -CMARK_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node); +CMARK_GFM_EXPORT cmark_delim_type cmark_node_get_list_delim(cmark_node *node); /** Sets the list delimiter type of 'node', returning 1 on success and 0 * on error. */ -CMARK_EXPORT int cmark_node_set_list_delim(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_list_delim(cmark_node *node, cmark_delim_type delim); /** Returns starting number of 'node', if it is an ordered list, otherwise 0. */ -CMARK_EXPORT int cmark_node_get_list_start(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_list_start(cmark_node *node); /** Sets starting number of 'node', if it is an ordered list. Returns 1 * on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_set_list_start(cmark_node *node, int start); +CMARK_GFM_EXPORT int cmark_node_set_list_start(cmark_node *node, int start); /** Returns 1 if 'node' is a tight list, 0 otherwise. */ -CMARK_EXPORT int cmark_node_get_list_tight(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_list_tight(cmark_node *node); /** Sets the "tightness" of a list. Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight); +CMARK_GFM_EXPORT int cmark_node_set_list_tight(cmark_node *node, int tight); /** Returns the info string from a fenced code block. */ -CMARK_EXPORT const char *cmark_node_get_fence_info(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_fence_info(cmark_node *node); /** Sets the info string in a fenced code block, returning 1 on * success and 0 on failure. */ -CMARK_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info); +CMARK_GFM_EXPORT int cmark_node_set_fence_info(cmark_node *node, const char *info); /** Sets code blocks fencing details */ -CMARK_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced, +CMARK_GFM_EXPORT int cmark_node_set_fenced(cmark_node * node, int fenced, int length, int offset, char character); /** Returns code blocks fencing details */ -CMARK_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character); +CMARK_GFM_EXPORT int cmark_node_get_fenced(cmark_node *node, int *length, int *offset, char *character); /** Returns the URL of a link or image 'node', or an empty string if no URL is set. Returns NULL if called on a node that is not a link or image. */ -CMARK_EXPORT const char *cmark_node_get_url(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_url(cmark_node *node); /** Sets the URL of a link or image 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_url(cmark_node *node, const char *url); +CMARK_GFM_EXPORT int cmark_node_set_url(cmark_node *node, const char *url); /** Returns the title of a link or image 'node', or an empty string if no title is set. Returns NULL if called on a node that is not a link or image. */ -CMARK_EXPORT const char *cmark_node_get_title(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_title(cmark_node *node); /** Sets the title of a link or image 'node'. Returns 1 on success, * 0 on failure. */ -CMARK_EXPORT int cmark_node_set_title(cmark_node *node, const char *title); +CMARK_GFM_EXPORT int cmark_node_set_title(cmark_node *node, const char *title); /** Returns the literal "on enter" text for a custom 'node', or an empty string if no on_enter is set. Returns NULL if called on a non-custom node. */ -CMARK_EXPORT const char *cmark_node_get_on_enter(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_on_enter(cmark_node *node); /** Sets the literal text to render "on enter" for a custom 'node'. Any children of the node will be rendered after this text. Returns 1 on success 0 on failure. */ -CMARK_EXPORT int cmark_node_set_on_enter(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_set_on_enter(cmark_node *node, const char *on_enter); /** Returns the literal "on exit" text for a custom 'node', or an empty string if no on_exit is set. Returns NULL if called on a non-custom node. */ -CMARK_EXPORT const char *cmark_node_get_on_exit(cmark_node *node); +CMARK_GFM_EXPORT const char *cmark_node_get_on_exit(cmark_node *node); /** Sets the literal text to render "on exit" for a custom 'node'. Any children of the node will be rendered before this text. Returns 1 on success 0 on failure. */ -CMARK_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit); +CMARK_GFM_EXPORT int cmark_node_set_on_exit(cmark_node *node, const char *on_exit); /** Returns the line on which 'node' begins. */ -CMARK_EXPORT int cmark_node_get_start_line(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_start_line(cmark_node *node); /** Returns the column at which 'node' begins. */ -CMARK_EXPORT int cmark_node_get_start_column(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_start_column(cmark_node *node); /** Returns the line on which 'node' ends. */ -CMARK_EXPORT int cmark_node_get_end_line(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_end_line(cmark_node *node); /** Returns the column at which 'node' ends. */ -CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node); +CMARK_GFM_EXPORT int cmark_node_get_end_column(cmark_node *node); /** * ## Tree Manipulation @@ -488,40 +488,40 @@ CMARK_EXPORT int cmark_node_get_end_column(cmark_node *node); /** Unlinks a 'node', removing it from the tree, but not freeing its * memory. (Use 'cmark_node_free' for that.) */ -CMARK_EXPORT void cmark_node_unlink(cmark_node *node); +CMARK_GFM_EXPORT void cmark_node_unlink(cmark_node *node); /** Inserts 'sibling' before 'node'. Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_insert_before(cmark_node *node, +CMARK_GFM_EXPORT int cmark_node_insert_before(cmark_node *node, cmark_node *sibling); /** Inserts 'sibling' after 'node'. Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling); +CMARK_GFM_EXPORT int cmark_node_insert_after(cmark_node *node, cmark_node *sibling); /** Replaces 'oldnode' with 'newnode' and unlinks 'oldnode' (but does * not free its memory). * Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode); +CMARK_GFM_EXPORT int cmark_node_replace(cmark_node *oldnode, cmark_node *newnode); /** Adds 'child' to the beginning of the children of 'node'. * Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child); +CMARK_GFM_EXPORT int cmark_node_prepend_child(cmark_node *node, cmark_node *child); /** Adds 'child' to the end of the children of 'node'. * Returns 1 on success, 0 on failure. */ -CMARK_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child); +CMARK_GFM_EXPORT int cmark_node_append_child(cmark_node *node, cmark_node *child); /** Consolidates adjacent text nodes. */ -CMARK_EXPORT void cmark_consolidate_text_nodes(cmark_node *root); +CMARK_GFM_EXPORT void cmark_consolidate_text_nodes(cmark_node *root); /** Ensures a node and all its children own their own chunk memory. */ -CMARK_EXPORT void cmark_node_own(cmark_node *root); +CMARK_GFM_EXPORT void cmark_node_own(cmark_node *root); /** * ## Parsing @@ -547,27 +547,27 @@ CMARK_EXPORT void cmark_node_own(cmark_node *root); /** Creates a new parser object. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_parser *cmark_parser_new(int options); /** Creates a new parser object with the given memory allocator */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_parser *cmark_parser_new_with_mem(int options, cmark_mem *mem); /** Frees memory allocated for a parser object. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_free(cmark_parser *parser); /** Feeds a string of length 'len' to 'parser'. */ -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parser_feed(cmark_parser *parser, const char *buffer, size_t len); /** Finish parsing and return a pointer to a tree of nodes. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_parser_finish(cmark_parser *parser); /** Parse a CommonMark document in 'buffer' of length 'len'. @@ -575,14 +575,14 @@ cmark_node *cmark_parser_finish(cmark_parser *parser); * the node tree should be released using 'cmark_node_free' * when it is no longer needed. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_parse_document(const char *buffer, size_t len, int options); /** Parse a CommonMark document in file 'f', returning a pointer to * a tree of nodes. The memory allocated for the node tree should be * released using 'cmark_node_free' when it is no longer needed. */ -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_node *cmark_parse_file(FILE *f, int options); /** @@ -592,74 +592,74 @@ cmark_node *cmark_parse_file(FILE *f, int options); /** Render a 'node' tree as XML. It is the caller's responsibility * to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_xml(cmark_node *root, int options); /** As for 'cmark_render_xml', but specifying the allocator to use for * the resulting string. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_xml_with_mem(cmark_node *root, int options, cmark_mem *mem); /** Render a 'node' tree as an HTML fragment. It is up to the user * to add an appropriate header and footer. It is the caller's * responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_html(cmark_node *root, int options, cmark_llist *extensions); /** As for 'cmark_render_html', but specifying the allocator to use for * the resulting string. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_html_with_mem(cmark_node *root, int options, cmark_llist *extensions, cmark_mem *mem); /** Render a 'node' tree as a groff man page, without the header. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_man(cmark_node *root, int options, int width); /** As for 'cmark_render_man', but specifying the allocator to use for * the resulting string. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_man_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); /** Render a 'node' tree as a commonmark document. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_commonmark(cmark_node *root, int options, int width); /** As for 'cmark_render_commonmark', but specifying the allocator to use for * the resulting string. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_commonmark_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); /** Render a 'node' tree as a plain text document. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_plaintext(cmark_node *root, int options, int width); /** As for 'cmark_render_plaintext', but specifying the allocator to use for * the resulting string. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_plaintext_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); /** Render a 'node' tree as a LaTeX document. * It is the caller's responsibility to free the returned buffer. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_latex(cmark_node *root, int options, int width); /** As for 'cmark_render_latex', but specifying the allocator to use for * the resulting string. */ -CMARK_EXPORT +CMARK_GFM_EXPORT char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmark_mem *mem); /** @@ -751,13 +751,13 @@ char *cmark_render_latex_with_mem(cmark_node *root, int options, int width, cmar * * In hexadecimal format, the number 0x010203 represents version 1.2.3. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_version(void); /** The library version string for runtime checks. Also available as * macro CMARK_VERSION_STRING for compile time checks. */ -CMARK_EXPORT +CMARK_GFM_EXPORT const char *cmark_version_string(void); /** # AUTHORS diff --git a/src/cmark-gfm_version.h.in b/src/cmark-gfm_version.h.in new file mode 100644 index 000000000..0847d0095 --- /dev/null +++ b/src/cmark-gfm_version.h.in @@ -0,0 +1,7 @@ +#ifndef CMARK_GFM_VERSION_H +#define CMARK_GFM_VERSION_H + +#define CMARK_GFM_VERSION ((@PROJECT_VERSION_MAJOR@ << 24) | (@PROJECT_VERSION_MINOR@ << 16) | (@PROJECT_VERSION_PATCH@ << 8) | @PROJECT_VERSION_GFM@) +#define CMARK_GFM_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.gfm.@PROJECT_VERSION_GFM@" + +#endif diff --git a/src/cmark.c b/src/cmark.c index f6b4cdf77..b3fad4b08 100644 --- a/src/cmark.c +++ b/src/cmark.c @@ -4,15 +4,15 @@ #include "registry.h" #include "node.h" #include "houdini.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "buffer.h" cmark_node_type CMARK_NODE_LAST_BLOCK = CMARK_NODE_FOOTNOTE_DEFINITION; cmark_node_type CMARK_NODE_LAST_INLINE = CMARK_NODE_FOOTNOTE_REFERENCE; -int cmark_version() { return CMARK_VERSION; } +int cmark_version() { return CMARK_GFM_VERSION; } -const char *cmark_version_string() { return CMARK_VERSION_STRING; } +const char *cmark_version_string() { return CMARK_GFM_VERSION_STRING; } static void *xcalloc(size_t nmem, size_t size) { void *ptr = calloc(nmem, size); diff --git a/src/cmark_ctype.h b/src/cmark_ctype.h index 4b90940a0..67c1cb037 100644 --- a/src/cmark_ctype.h +++ b/src/cmark_ctype.h @@ -5,25 +5,25 @@ extern "C" { #endif -#include "cmark_export.h" +#include "cmark-gfm_export.h" /** Locale-independent versions of functions from ctype.h. * We want cmark to behave the same no matter what the system locale. */ -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_isspace(char c); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_ispunct(char c); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_isalnum(char c); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_isdigit(char c); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_isalpha(char c); #ifdef __cplusplus diff --git a/src/cmark_version.h.in b/src/cmark_version.h.in deleted file mode 100644 index f1ae0990a..000000000 --- a/src/cmark_version.h.in +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef CMARK_VERSION_H -#define CMARK_VERSION_H - -#define CMARK_VERSION ((@PROJECT_VERSION_MAJOR@ << 24) | (@PROJECT_VERSION_MINOR@ << 16) | (@PROJECT_VERSION_PATCH@ << 8) | @PROJECT_VERSION_GFM@) -#define CMARK_VERSION_STRING "@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@.gfm.@PROJECT_VERSION_GFM@" -#define CMARK_GFM_VERSION @PROJECT_VERSION_GFM@ - -#endif diff --git a/src/commonmark.c b/src/commonmark.c index ab2692c0e..9943e4c53 100644 --- a/src/commonmark.c +++ b/src/commonmark.c @@ -5,7 +5,7 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "utf8.h" diff --git a/src/footnotes.c b/src/footnotes.c index ccd452cc1..f2d2765f4 100644 --- a/src/footnotes.c +++ b/src/footnotes.c @@ -1,4 +1,4 @@ -#include "cmark.h" +#include "cmark-gfm.h" #include "parser.h" #include "footnotes.h" #include "inlines.h" diff --git a/src/houdini.h b/src/houdini.h index 7852c3a83..7625b045b 100644 --- a/src/houdini.h +++ b/src/houdini.h @@ -31,22 +31,22 @@ extern "C" { #define HOUDINI_ESCAPED_SIZE(x) (((x)*12) / 10) #define HOUDINI_UNESCAPED_SIZE(x) (x) -CMARK_EXPORT +CMARK_GFM_EXPORT bufsize_t houdini_unescape_ent(cmark_strbuf *ob, const uint8_t *src, bufsize_t size); -CMARK_EXPORT +CMARK_GFM_EXPORT int houdini_escape_html(cmark_strbuf *ob, const uint8_t *src, bufsize_t size); -CMARK_EXPORT +CMARK_GFM_EXPORT int houdini_escape_html0(cmark_strbuf *ob, const uint8_t *src, bufsize_t size, int secure); -CMARK_EXPORT +CMARK_GFM_EXPORT int houdini_unescape_html(cmark_strbuf *ob, const uint8_t *src, bufsize_t size); -CMARK_EXPORT +CMARK_GFM_EXPORT void houdini_unescape_html_f(cmark_strbuf *ob, const uint8_t *src, bufsize_t size); -CMARK_EXPORT +CMARK_GFM_EXPORT int houdini_escape_href(cmark_strbuf *ob, const uint8_t *src, bufsize_t size); diff --git a/src/html.c b/src/html.c index c9ef17f74..7a34f7e91 100644 --- a/src/html.c +++ b/src/html.c @@ -4,7 +4,7 @@ #include #include "cmark_ctype.h" #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "houdini.h" #include "scanners.h" #include "syntax_extension.h" diff --git a/src/inlines.c b/src/inlines.c index 31c3b8333..45a634877 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -7,7 +7,7 @@ #include "node.h" #include "parser.h" #include "references.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "houdini.h" #include "utf8.h" #include "scanners.h" diff --git a/src/inlines.h b/src/inlines.h index 8c8174c64..7dd91bf52 100644 --- a/src/inlines.h +++ b/src/inlines.h @@ -10,7 +10,7 @@ extern "C" { cmark_chunk cmark_clean_url(cmark_mem *mem, cmark_chunk *url); cmark_chunk cmark_clean_title(cmark_mem *mem, cmark_chunk *title); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_parse_inlines(cmark_parser *parser, cmark_node *parent, cmark_map *refmap, diff --git a/src/iterator.c b/src/iterator.c index 5557dff31..13fdb7616 100644 --- a/src/iterator.c +++ b/src/iterator.c @@ -3,7 +3,7 @@ #include "config.h" #include "node.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "iterator.h" cmark_iter *cmark_iter_new(cmark_node *root) { diff --git a/src/iterator.h b/src/iterator.h index fc745df5b..1155593df 100644 --- a/src/iterator.h +++ b/src/iterator.h @@ -5,7 +5,7 @@ extern "C" { #endif -#include "cmark.h" +#include "cmark-gfm.h" #include "memory.h" typedef struct { diff --git a/src/latex.c b/src/latex.c index 1767cee39..8be15b0d5 100644 --- a/src/latex.c +++ b/src/latex.c @@ -4,7 +4,7 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "utf8.h" diff --git a/src/libcmark-gfm.pc.in b/src/libcmark-gfm.pc.in index 4aeca7c53..46fff31a2 100644 --- a/src/libcmark-gfm.pc.in +++ b/src/libcmark-gfm.pc.in @@ -6,5 +6,5 @@ includedir=@CMAKE_INSTALL_PREFIX@/include Name: libcmark-gfm Description: CommonMark parsing, rendering, and manipulation with GitHub Flavored Markdown extensions Version: @PROJECT_VERSION@ -Libs: -L${libdir} -lcmark-gfm -lcmark-gfmextensions +Libs: -L${libdir} -lcmark-gfm -lcmark-gfm-extensions Cflags: -I${includedir} diff --git a/src/linked_list.c b/src/linked_list.c index f8bc60422..8c26dc557 100644 --- a/src/linked_list.c +++ b/src/linked_list.c @@ -1,6 +1,6 @@ #include -#include "cmark.h" +#include "cmark-gfm.h" cmark_llist *cmark_llist_append(cmark_mem *mem, cmark_llist *head, void *data) { cmark_llist *tmp; diff --git a/src/main.c b/src/main.c index 9c79598c7..8fd612b7b 100644 --- a/src/main.c +++ b/src/main.c @@ -4,14 +4,14 @@ #include #include "config.h" #include "memory.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" -#include "cmark_extension_api.h" +#include "cmark-gfm-extension_api.h" #include "syntax_extension.h" #include "parser.h" #include "registry.h" -#include "../extensions/core-extensions.h" +#include "../extensions/cmark-gfm-core-extensions.h" #if defined(_WIN32) && !defined(__CYGWIN__) #include @@ -118,7 +118,7 @@ int main(int argc, char *argv[]) { int options = CMARK_OPT_DEFAULT; int res = 1; - core_extensions_ensure_registered(); + cmark_gfm_core_extensions_ensure_registered(); #if defined(_WIN32) && !defined(__CYGWIN__) _setmode(_fileno(stdin), _O_BINARY); @@ -129,8 +129,8 @@ int main(int argc, char *argv[]) { for (i = 1; i < argc; i++) { if (strcmp(argv[i], "--version") == 0) { - printf("cmark %s", CMARK_VERSION_STRING); - printf(" - CommonMark converter\n(C) 2014-2016 John MacFarlane\n"); + printf("cmark-gfm %s", CMARK_GFM_VERSION_STRING); + printf(" - CommonMark with GitHub Flavored Markdown converter\n(C) 2014-2016 John MacFarlane\n"); goto success; } else if (strcmp(argv[i], "--list-extensions") == 0) { print_extensions(); diff --git a/src/man.c b/src/man.c index 1e1a69d26..441a96e49 100644 --- a/src/man.c +++ b/src/man.c @@ -4,7 +4,7 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "utf8.h" diff --git a/src/node.h b/src/node.h index 1d8aa50df..0a392555b 100644 --- a/src/node.h +++ b/src/node.h @@ -8,8 +8,8 @@ extern "C" { #include #include -#include "cmark.h" -#include "cmark_extension_api.h" +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" #include "buffer.h" #include "chunk.h" @@ -89,7 +89,7 @@ struct cmark_node { static CMARK_INLINE cmark_mem *cmark_node_mem(cmark_node *node) { return node->content.mem; } -CMARK_EXPORT int cmark_node_check(cmark_node *node, FILE *out); +CMARK_GFM_EXPORT int cmark_node_check(cmark_node *node, FILE *out); static CMARK_INLINE bool CMARK_NODE_TYPE_BLOCK_P(cmark_node_type node_type) { return (node_type & CMARK_NODE_TYPE_MASK) == CMARK_NODE_TYPE_BLOCK; @@ -107,7 +107,7 @@ static CMARK_INLINE bool CMARK_NODE_INLINE_P(cmark_node *node) { return node != NULL && CMARK_NODE_TYPE_INLINE_P((cmark_node_type) node->type); } -CMARK_EXPORT bool cmark_node_can_contain_type(cmark_node *node, cmark_node_type child_type); +CMARK_GFM_EXPORT bool cmark_node_can_contain_type(cmark_node *node, cmark_node_type child_type); #ifdef __cplusplus } diff --git a/src/plugin.h b/src/plugin.h index b9e9d2994..7bcbd19a2 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -5,8 +5,8 @@ extern "C" { #endif -#include "cmark.h" -#include "cmark_extension_api.h" +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" /** * cmark_plugin: diff --git a/src/references.c b/src/references.c index 2cd4b4435..7e7f34b38 100644 --- a/src/references.c +++ b/src/references.c @@ -1,4 +1,4 @@ -#include "cmark.h" +#include "cmark-gfm.h" #include "parser.h" #include "references.h" #include "inlines.h" diff --git a/src/registry.c b/src/registry.c index 3ff01f2ad..f4f2040d6 100644 --- a/src/registry.c +++ b/src/registry.c @@ -3,7 +3,7 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "syntax_extension.h" #include "registry.h" #include "plugin.h" diff --git a/src/registry.h b/src/registry.h index 0f0fbae26..fece2b63f 100644 --- a/src/registry.h +++ b/src/registry.h @@ -5,16 +5,16 @@ extern "C" { #endif -#include "cmark.h" +#include "cmark-gfm.h" #include "plugin.h" -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_register_plugin(cmark_plugin_init_func reg_fn); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_release_plugins(void); -CMARK_EXPORT +CMARK_GFM_EXPORT cmark_llist *cmark_list_syntax_extensions(cmark_mem *mem); #ifdef __cplusplus diff --git a/src/render.c b/src/render.c index 7f0902462..feb207544 100644 --- a/src/render.c +++ b/src/render.c @@ -1,7 +1,7 @@ #include #include "buffer.h" #include "chunk.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "utf8.h" #include "render.h" #include "node.h" diff --git a/src/scanners.h b/src/scanners.h index ffdbaeb06..1e5c8ccd8 100644 --- a/src/scanners.h +++ b/src/scanners.h @@ -1,7 +1,7 @@ #ifndef CMARK_SCANNERS_H #define CMARK_SCANNERS_H -#include "cmark.h" +#include "cmark-gfm.h" #include "chunk.h" #ifdef __cplusplus diff --git a/src/syntax_extension.c b/src/syntax_extension.c index d079efade..f5c00bb4a 100644 --- a/src/syntax_extension.c +++ b/src/syntax_extension.c @@ -1,7 +1,7 @@ #include #include -#include "cmark.h" +#include "cmark-gfm.h" #include "syntax_extension.h" #include "buffer.h" diff --git a/src/syntax_extension.h b/src/syntax_extension.h index f51f1f4ca..e0390b2a2 100644 --- a/src/syntax_extension.h +++ b/src/syntax_extension.h @@ -1,8 +1,8 @@ #ifndef CMARK_SYNTAX_EXTENSION_H #define CMARK_SYNTAX_EXTENSION_H -#include "cmark.h" -#include "cmark_extension_api.h" +#include "cmark-gfm.h" +#include "cmark-gfm-extension_api.h" #include "config.h" struct cmark_syntax_extension { diff --git a/src/utf8.h b/src/utf8.h index 5e6434483..04ec1611b 100644 --- a/src/utf8.h +++ b/src/utf8.h @@ -8,24 +8,24 @@ extern "C" { #endif -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_utf8proc_case_fold(cmark_strbuf *dest, const uint8_t *str, bufsize_t len); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_utf8proc_encode_char(int32_t uc, cmark_strbuf *buf); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_utf8proc_iterate(const uint8_t *str, bufsize_t str_len, int32_t *dst); -CMARK_EXPORT +CMARK_GFM_EXPORT void cmark_utf8proc_check(cmark_strbuf *dest, const uint8_t *line, bufsize_t size); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_utf8proc_is_space(int32_t uc); -CMARK_EXPORT +CMARK_GFM_EXPORT int cmark_utf8proc_is_punctuation(int32_t uc); #ifdef __cplusplus diff --git a/src/xml.c b/src/xml.c index ea53b99c6..920fe7171 100644 --- a/src/xml.c +++ b/src/xml.c @@ -4,7 +4,7 @@ #include #include "config.h" -#include "cmark.h" +#include "cmark-gfm.h" #include "node.h" #include "buffer.h" #include "houdini.h" diff --git a/test/cmark-fuzz.c b/test/cmark-fuzz.c index 6425c1492..3a263efc9 100644 --- a/test/cmark-fuzz.c +++ b/test/cmark-fuzz.c @@ -1,6 +1,6 @@ #include #include -#include "cmark.h" +#include "cmark-gfm.h" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { int options = 0; diff --git a/test/cmark.py b/test/cmark.py index 44d0dc8bf..c9f484b06 100644 --- a/test/cmark.py +++ b/test/cmark.py @@ -12,7 +12,7 @@ def pipe_through_prog(prog, text): return [p1.returncode, result.decode('utf-8'), err] def parse(lib, extlib, text, extensions): - core_extensions_ensure_registered = extlib.core_extensions_ensure_registered + cmark_gfm_core_extensions_ensure_registered = extlib.cmark_gfm_core_extensions_ensure_registered find_syntax_extension = lib.cmark_find_syntax_extension find_syntax_extension.restype = c_void_p @@ -32,7 +32,7 @@ def parse(lib, extlib, text, extensions): parser_finish.restype = c_void_p parser_finish.argtypes = [c_void_p] - core_extensions_ensure_registered() + cmark_gfm_core_extensions_ensure_registered() parser = parser_new(0) for e in set(extensions): @@ -97,7 +97,7 @@ def __init__(self, prog=None, library_dir=None, extensions=None): break cmark = CDLL(libpath) extlib = CDLL(os.path.join( - library_dir, "..", "extensions", prefix + "cmark-gfmextensions" + suffix)) + library_dir, "..", "extensions", prefix + "cmark-gfm-extensions" + suffix)) self.to_html = lambda x, exts=[]: to_html(cmark, extlib, x, exts + self.extensions) self.to_commonmark = lambda x, exts=[]: to_commonmark(cmark, extlib, x, exts + self.extensions) diff --git a/wrappers/wrapper_ext.py b/wrappers/wrapper_ext.py index 1d6f9785e..f08cc2076 100755 --- a/wrappers/wrapper_ext.py +++ b/wrappers/wrapper_ext.py @@ -3,9 +3,9 @@ # # Example for using the shared library from python. # Will work with either python 2 or python 3. -# Requires cmark-gfm and cmark-gfmextensions libraries to be installed. +# Requires cmark-gfm and cmark-gfm-extensions libraries to be installed. # -# This particular example uses the GitHub extensions from the gfmextensions +# This particular example uses the GitHub extensions from the gfm-extensions # library. EXTENSIONS specifies which to use, and the sample shows how to # connect them into a parser. # @@ -15,13 +15,13 @@ if sys.platform == 'darwin': libname = 'libcmark-gfm.dylib' - extname = 'libcmark-gfmextensions.dylib' + extname = 'libcmark-gfm-extensions.dylib' elif sys.platform == 'win32': libname = 'cmark-gfm.dll' - extname = 'cmark-gfmextensions.dll' + extname = 'cmark-gfm-extensions.dll' else: libname = 'libcmark-gfm.so' - extname = 'libcmark-gfmextensions.so' + extname = 'libcmark-gfm-extensions.so' cmark = ctypes.CDLL(libname) cmark_ext = ctypes.CDLL(extname) @@ -76,7 +76,7 @@ # Set up the libcmark-gfm library and its extensions -F_register = cmark_ext.core_extensions_ensure_registered +F_register = cmark_ext.cmark_gfm_core_extensions_ensure_registered F_register.restype = None F_register.argtypes = ( ) F_register()