summaryrefslogtreecommitdiffstats
path: root/src/markdown.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/markdown.cpp')
-rw-r--r--src/markdown.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/markdown.cpp b/src/markdown.cpp
index d63e149..22e0d50 100644
--- a/src/markdown.cpp
+++ b/src/markdown.cpp
@@ -59,6 +59,11 @@
(data[i]>='0' && data[i]<='9') || \
(((unsigned char)data[i])>=0x80)) // unicode characters
+#define extraChar(i) \
+ (data[i]=='-' || data[i]=='+' || data[i]=='!' || \
+ data[i]=='?' || data[i]=='$' || data[i]=='@' || \
+ data[i]=='&' || data[i]=='*' || data[i]=='%')
+
// is character at position i in data allowed before an emphasis section
#define isOpenEmphChar(i) \
(data[i]=='\n' || data[i]==' ' || data[i]=='\'' || data[i]=='<' || \
@@ -592,8 +597,8 @@ static int processHtmlTag(GrowBuf &out,const char *data,int offset,int size)
static int processEmphasis(GrowBuf &out,const char *data,int offset,int size)
{
if ((offset>0 && !isOpenEmphChar(-1)) || // invalid char before * or _
- (size>1 && data[0]!=data[1] && !(isIdChar(1) || data[1]=='[')) || // invalid char after * or _
- (size>2 && data[0]==data[1] && !(isIdChar(2) || data[2]=='['))) // invalid char after ** or __
+ (size>1 && data[0]!=data[1] && !(isIdChar(1) || extraChar(1) || data[1]=='[')) || // invalid char after * or _
+ (size>2 && data[0]==data[1] && !(isIdChar(2) || extraChar(2) || data[2]=='['))) // invalid char after ** or __
{
return 0;
}