summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/markdown.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index 2cbdcb5..3ee1b71 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -480,7 +480,8 @@ static int processNmdash(GrowBuf &out,const char *data,int off,int size)
{
count++;
}
- if (count==2 && off>=2 && qstrncmp(data-2,"<!",2)==0) return 0; // start HTML comment
+ if ((count==2 || count==3)&& off>=2 && qstrncmp(data-2,"<!",2)==0) return 2-count; // start HTML comment
+ if (count>=4 && off>=2 && qstrncmp(data-2,"<!",2)==0) return -1; // start HTML comment
if (count==2 && (data[2]=='>')) return 0; // end HTML comment
if (count==2 && (off<8 || qstrncmp(data-8,"operator",8)!=0)) // -- => ndash
{
@@ -1088,6 +1089,10 @@ static void processInline(GrowBuf &out,const char *data,int size)
{
end=i+1;
}
+ else if (end < 0)
+ {
+ end=i-end+1;
+ }
else
{
i+=end;