+void markdown_debug(deck_t *deck, int debug) {
+
+ int sc = 0; // slide count
+ int lc = 0; // line count
+
+ int offset;
+ line_t *header;
+
+ if(debug == 1) {
+ fprintf(stderr, "headers: %i\nslides: %i\n", deck->headers, deck->slides);
+
+ } else if(debug > 1) {
+
+ // print header to STDERR
+ if(deck->header) {
+ header = deck->header;
+ while(header &&
+ header->length > 0 &&
+ header->text->text[0] == '%') {
+
+ // skip descriptor word (e.g. %title:)
+ offset = next_blank(header->text, 0) + 1;
+
+ fprintf(stderr, "header: %s\n", &header->text->text[offset]);
+ header = header->next;
+ }
+ }
+ }
+
+ slide_t *slide = deck->slide;
+ line_t *line;
+
+ // print slide/line count to STDERR
+ while(slide) {
+ sc++;
+
+ if(debug == 1) {
+ fprintf(stderr, " slide %i: %i lines\n", sc, slide->lines);
+
+ } else if(debug > 1) {
+
+ // also print bits and line length
+ fprintf(stderr, " slide %i:\n", sc);
+ line = slide->line;
+ lc = 0;
+ while(line) {
+ lc++;
+ fprintf(stderr, " line %i: bits = %i, length = %i\n", lc, line->bits, line->length);
+ line = line->next;
+ }
+ }
+
+ slide = slide->next;
+ }
+}
+