cmark

My personal build of CMark ✏️

Commit
34cd161d7b70c39957f46c9602aef165d747a466
Parent
adfae46c7144eb65532e10961420f2ef58cac4ed
Author
John MacFarlane <jgm@berkeley.edu>
Date

commonmark writer - escape all #'s, not just at beginning of line.

This is needed for #s at the end of atx headers.

Diffstat

1 file changed, 2 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/commonmark.c 4 2 2
diff --git 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 &&