X-Git-Url: https://git.armaanb.net/?p=stagit.git;a=blobdiff_plain;f=src%2Fstagit.c;h=be6d8593c9913d3ac5f02ba7fc2381d46dcaa9ae;hp=247fe704d42aac14c2b78348849f7c4d11974680;hb=f1e24dd2761bd786a8bfae19812435b50c289cea;hpb=516f65ffea797d22346a1acf596e69673e1c9a1d diff --git a/src/stagit.c b/src/stagit.c index 247fe70..be6d859 100644 --- a/src/stagit.c +++ b/src/stagit.c @@ -14,7 +14,10 @@ #include #include + +#ifdef HAS_CMARK #include +#endif #include "cp.h" #include "compat.h" @@ -414,12 +417,17 @@ void call_chroma(const char *filename, FILE *fp, const char *s, size_t len) { htmlized = false; + char *html = ""; // Flush HTML-file fflush(fp); - char *html = cmark_markdown_to_html(s, len, CMARK_OPT_DEFAULT); +#ifdef HAS_CMARK + html = cmark_markdown_to_html(s, len, CMARK_OPT_DEFAULT); if (strcmp(get_ext(filename), "md") == 0) htmlized = true; +#endif + +#ifdef HAS_CHROMA if (!htmlized) { // Copy STDOUT int stdout_copy = dup(1); @@ -450,6 +458,9 @@ call_chroma(const char *filename, FILE *fp, const char *s, size_t len) } else { fprintf(fp, "%s", html); } +#else + fprintf(fp, "
%s
", s); +#endif } void