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 aa51e86f9eb9816919007cd73916336ed100e8d4
parent 71d74e9f55ca6bab1768eb3e201c87d455caf35f
Author: Martin Mitas <mity@morous.org>
Date:   Wed, 12 Jul 2017 22:52:58 +0200

md2html/md2html.c: Add options for Markdown dialect.

Added support for options --commonmark and --github.

Diffstat:
Mmd2html/md2html.c | 10++++++++++
1 file changed, 10 insertions(+), 0 deletions(-)

diff --git a/md2html/md2html.c b/md2html/md2html.c @@ -193,6 +193,8 @@ static const option cmdline_options[] = { { "stat", 's', 's', OPTION_ARG_NONE }, { "help", 'h', 'h', OPTION_ARG_NONE }, { "version", 'v', 'v', OPTION_ARG_NONE }, + { "commonmark", 0, 'c', OPTION_ARG_NONE }, + { "github", 0, 'g', 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 }, @@ -221,6 +223,11 @@ usage(void) " -h, --help Display this help and exit\n" " -v, --version Display version and exit\n" "\n" + "Markdown dialect options:\n" + "(note these are equivalent to some combinations of flags below)\n" + " --commonmark CommonMark (this is default)\n" + " --github Github Flavored Markdown\n" + "\n" "Markdown extension options:\n" " --fcollapse-whitespace\n" " Collapse non-trivial whitespace\n" @@ -273,6 +280,9 @@ cmdline_callback(int opt, char const* value, void* data) case 'h': usage(); exit(0); break; case 'v': version(); exit(0); break; + case 'c': parser_flags = MD_DIALECT_COMMONMARK; break; + case 'g': parser_flags = MD_DIALECT_GITHUB; break; + case 'E': renderer_flags |= MD_RENDER_FLAG_VERBATIM_ENTITIES; break; case 'A': parser_flags |= MD_FLAG_PERMISSIVEATXHEADERS; break; case 'I': parser_flags |= MD_FLAG_NOINDENTEDCODEBLOCKS; break;