summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTzu-ping Chung <uranusjr@gmail.com>2014-11-14 10:25:12 +0800
committerTzu-ping Chung <uranusjr@gmail.com>2014-11-14 10:25:48 +0800
commit6d16d197353e43b0fc299b8c250bdbff0c581b15 (patch)
tree028b7f854377c07f4fbf7f27f2320aa69d44607b
parent3afc3ec505dd7dd902086f8c158290962e705663 (diff)
downloadrust-hoedown-6d16d197353e43b0fc299b8c250bdbff0c581b15.tar.gz
Special-case comment tag to ignore all its content
Fix #143
-rw-r--r--src/html_smartypants.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/html_smartypants.c b/src/html_smartypants.c
index bbe4fc5..b0904da 100644
--- a/src/html_smartypants.c
+++ b/src/html_smartypants.c
@@ -313,6 +313,16 @@ smartypants_cb__ltag(hoedown_buffer *ob, struct smartypants_data *smrt, uint8_t
size_t tag, i = 0;
+ /* This is a comment. Copy everything verbatim until --> or EOF is seen. */
+ if (i + 4 < size && memcmp(text, "<!--", 4) == 0) {
+ i += 4;
+ while (i + 3 < size && memcmp(text + i, "-->", 3) != 0)
+ i++;
+ i += 3;
+ hoedown_buffer_put(ob, text, i + 1);
+ return i;
+ }
+
while (i < size && text[i] != '>')
i++;