Fix directly nested markdown entities

This commit is contained in:
Lonami Exo 2019-07-06 12:55:44 +02:00
parent 8e36bb4c4d
commit 05b770a93f

View File

@ -90,6 +90,10 @@ def parse(message, delimiters=None, url_re=None):
for ent in result:
# If the end is after our start, it is affected
if ent.offset + ent.length > i:
# If the old start is also before ours, it is fully enclosed
if ent.offset <= i:
ent.length -= len(delim) * 2
else:
ent.length -= len(delim)
# Append the found entity