summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-03 22:12:49 -0700
committerJohn MacFarlane <fiddlosopher@gmail.com>2015-07-05 16:11:36 -0700
commitafc1b89ac71b642a841c8b79ea0ec6b70d2adae5 (patch)
tree4ef3e3080d2d38ca8514a6e3055c4817163b3012 /src/main.c
parent46e9ed6e0c118dc6b6a4a4833d6c960701849fdb (diff)
Added LaTeX renderer.
* New exported function in API: `cmark_render_latex`. * Added src/latex.hs. * Updated README and man page. * Closes #31.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 5dc97b2..e20b0dc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -17,14 +17,15 @@ typedef enum {
FORMAT_HTML,
FORMAT_XML,
FORMAT_MAN,
- FORMAT_COMMONMARK
+ FORMAT_COMMONMARK,
+ FORMAT_LATEX
} writer_format;
void print_usage()
{
printf("Usage: cmark [FILE*]\n");
printf("Options:\n");
- printf(" --to, -t FORMAT Specify output format (html, xml, man, commonmark)\n");
+ printf(" --to, -t FORMAT Specify output format (html, xml, man, commonmark, latex)\n");
printf(" --width WIDTH Specify wrap width (default 0 = nowrap)\n");
printf(" --sourcepos Include source position attribute\n");
printf(" --hardbreaks Treat newlines as hard line breaks\n");
@@ -52,6 +53,9 @@ static void print_document(cmark_node *document, writer_format writer,
case FORMAT_COMMONMARK:
result = cmark_render_commonmark(document, options, width);
break;
+ case FORMAT_LATEX:
+ result = cmark_render_latex(document, options, width);
+ break;
default:
fprintf(stderr, "Unknown format %d\n", writer);
exit(1);
@@ -125,6 +129,8 @@ int main(int argc, char *argv[])
writer = FORMAT_XML;
} else if (strcmp(argv[i], "commonmark") == 0) {
writer = FORMAT_COMMONMARK;
+ } else if (strcmp(argv[i], "latex") == 0) {
+ writer = FORMAT_LATEX;
} else {
fprintf(stderr,
"Unknown format %s\n", argv[i]);