summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2015-07-12 20:17:12 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2015-07-12 20:17:12 -0700
commit34cd161d7b70c39957f46c9602aef165d747a466 (patch)
treeaa30503728d166ec1daf04df3db87978ab9f4ea0
parentadfae46c7144eb65532e10961420f2ef58cac4ed (diff)
commonmark writer - escape all #'s, not just at beginning of line.
This is needed for #s at the end of atx headers.
-rw-r--r--src/commonmark.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/commonmark.c b/src/commonmark.c
index 088b934..5d5cd8a 100644
--- a/src/commonmark.c
+++ b/src/commonmark.c
@@ -29,12 +29,12 @@ static inline void outc(cmark_renderer *renderer,
needs_escaping =
escape != LITERAL &&
((escape == NORMAL &&
- (c == '*' || c == '_' || c == '[' || c == ']' ||
+ (c == '*' || c == '_' || c == '[' || c == ']' || c == '#' ||
c == '<' || c == '>' || c == '\\' || c == '`' ||
(c == '&' && isalpha(nextc)) ||
(c == '!' && nextc == '[') ||
(renderer->begin_line &&
- (c == '-' || c == '+' || c == '#' || c == '=')) ||
+ (c == '-' || c == '+' || c == '=')) ||
((c == '.' || c == ')') &&
isdigit(renderer->buffer->ptr[renderer->buffer->size - 1])))) ||
(escape == URL &&