diff --git a/src/main.c b/src/main.c
@@ -17,13 +17,14 @@ typedef enum {
FORMAT_HTML,
FORMAT_XML,
FORMAT_MAN,
+ FORMAT_COMMONMARK
} writer_format;
void print_usage()
{
printf("Usage: cmark [FILE*]\n");
printf("Options:\n");
- printf(" --to, -t FORMAT Specify output format (html, xml, man)\n");
+ printf(" --to, -t FORMAT Specify output format (html, xml, man, commonmark)\n");
printf(" --sourcepos Include source position attribute\n");
printf(" --hardbreaks Treat newlines as hard line breaks\n");
printf(" --smart Use smart punctuation\n");
@@ -46,6 +47,9 @@ static void print_document(cmark_node *document, writer_format writer,
case FORMAT_MAN:
result = cmark_render_man(document, options);
break;
+ case FORMAT_COMMONMARK:
+ result = cmark_render_commonmark(document, options);
+ break;
default:
fprintf(stderr, "Unknown format %d\n", writer);
exit(1);
@@ -98,6 +102,8 @@ int main(int argc, char *argv[])
writer = FORMAT_HTML;
} else if (strcmp(argv[i], "xml") == 0) {
writer = FORMAT_XML;
+ } else if (strcmp(argv[i], "commonmark") == 0) {
+ writer = FORMAT_COMMONMARK;
} else {
fprintf(stderr,
"Unknown format %s\n", argv[i]);