md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
git clone https://noulin.net/git/md4c.git
Log | Files | Refs | README | LICENSE

commit c377f567af1524d6bd23bfc2e93a308c449fa2c1
parent c9ef8ccb2f6b93bf4aa24399d8cb32edacf0f34c
Author: Martin Mitas <mity@morous.org>
Date:   Fri, 16 Dec 2016 10:06:07 +0100

Add some versioning info.

 * md4c.h now contains macros MD_VERSION_xxxx.
 * md2html has option --version.

(Of course those shall have some meaningful values only when we introduce
some release process.)

Diffstat:
Mmd2html/md2html.c | 9+++++++++
Mmd4c/md4c.h | 5+++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/md2html/md2html.c b/md2html/md2html.c @@ -192,6 +192,7 @@ static const option cmdline_options[] = { { "full-html", 'f', 'f', OPTION_ARG_NONE }, { "stat", 's', 's', OPTION_ARG_NONE }, { "help", 'h', 'h', OPTION_ARG_NONE }, + { "version", 'v', 'v', OPTION_ARG_NONE }, { "fverbatim-entities", 0, 'E', OPTION_ARG_NONE }, { "fpermissive-atx-headers", 0, 'A', OPTION_ARG_NONE }, { "fpermissive-url-autolinks", 0, 'U', OPTION_ARG_NONE }, @@ -218,6 +219,7 @@ usage(void) " -f, --full-html Generate full HTML document, including header\n" " -s, --stat Measure time of input parsing\n" " -h, --help Display this help and exit\n" + " -v, --version Display version and exit\n" "\n" "Markdown extension options:\n" " --fcollapse-whitespace\n" @@ -243,6 +245,12 @@ usage(void) ); } +static void +version(void) +{ + printf("%d.%d.%d\n", MD_VERSION_MAJOR, MD_VERSION_MINOR, MD_VERSION_RELEASE); +} + static const char* input_path = NULL; static const char* output_path = NULL; @@ -263,6 +271,7 @@ cmdline_callback(int opt, char const* value, void* data) case 'f': want_fullhtml = 1; break; case 's': want_stat = 1; break; case 'h': usage(); exit(0); break; + case 'v': version(); exit(0); break; case 'E': renderer_flags |= MD_RENDER_FLAG_VERBATIM_ENTITIES; break; case 'A': parser_flags |= MD_FLAG_PERMISSIVEATXHEADERS; break; diff --git a/md4c/md4c.h b/md4c/md4c.h @@ -31,6 +31,11 @@ #endif +#define MD_VERSION_MAJOR 0 +#define MD_VERSION_MINOR 2 +#define MD_VERSION_RELEASE 0 + + /* Magic to support UTF-16. */ #if defined MD4C_USE_UTF16 #ifdef _WIN32