diff options
author | John MacFarlane <jgm@berkeley.edu> | 2019-04-06 10:19:12 -0700 |
---|---|---|
committer | John MacFarlane <jgm@berkeley.edu> | 2019-04-06 10:19:12 -0700 |
commit | becfb75e9f2f85cfff18aec49fd96e252f737eb2 (patch) | |
tree | c83e5efdc3ec8eb08270450889ce8b0162005916 /src | |
parent | 6f1f4e312016261143b3ebf91e35a1ddb805cdf1 (diff) |
render: only emit actual newline when escape mode is LITERAL.
For markdown content, e.g., in other contexts we want some
kind of escaping, not a literal newline.
Diffstat (limited to 'src')
-rw-r--r-- | src/render.c | 30 |
1 files changed, 16 insertions, 14 deletions
diff --git a/src/render.c b/src/render.c index a73d6f8..fdd73df 100644 --- a/src/render.c +++ b/src/render.c @@ -82,21 +82,23 @@ static void S_out(cmark_renderer *renderer, const char *source, bool wrap, } } - } else if (c == 10) { - cmark_strbuf_putc(renderer->buffer, '\n'); - renderer->column = 0; - renderer->begin_line = true; - renderer->begin_content = true; - renderer->last_breakable = 0; } else if (escape == LITERAL) { - cmark_render_code_point(renderer, c); - renderer->begin_line = false; - // we don't set 'begin_content' to false til we've - // finished parsing a digit. Reason: in commonmark - // we need to escape a potential list marker after - // a digit: - renderer->begin_content = - renderer->begin_content && cmark_isdigit(c) == 1; + if (c == 10) { + cmark_strbuf_putc(renderer->buffer, '\n'); + renderer->column = 0; + renderer->begin_line = true; + renderer->begin_content = true; + renderer->last_breakable = 0; + } else { + cmark_render_code_point(renderer, c); + renderer->begin_line = false; + // we don't set 'begin_content' to false til we've + // finished parsing a digit. Reason: in commonmark + // we need to escape a potential list marker after + // a digit: + renderer->begin_content = + renderer->begin_content && cmark_isdigit(c) == 1; + } } else { (renderer->outc)(renderer, escape, c, nextc); renderer->begin_line = false; |