#include <unistd.h>
#include <git2.h>
+
+#ifdef HAS_CMARK
#include <cmark-gfm.h>
+#endif
#include "cp.h"
#include "compat.h"
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);
} else {
fprintf(fp, "%s", html);
}
+#else
+ fprintf(fp, "<pre>%s</pre>", s);
+#endif
}
void