MarkdownAttributedString icon indicating copy to clipboard operation
MarkdownAttributedString copied to clipboard

The function updateAttributedString() doesn't check for escaped endMarker

Open simonward opened this issue 5 years ago • 2 comments

In the function updateAttributedString():

endRange = [scanString rangeOfString:endMarker options:options range:remainingRange];

It doesn't check for an escaped endMarker:

if (hasCharacterRelative(scanString, endRange, -1, escapeCharacter)) { continueScan = YES; //scanEndIndex = endRange.location + endRange.length; scanEndIndex = endRange.location + 1; }

Therefore, it will fail to properly parse: [\(\)](http://apple.com)

simonward avatar May 27 '20 23:05 simonward

I added a test in ddfe1856d51a02234670b473fdf00f11107f4cdf and will be fixing this in the improvements I have planned for escaping literals.

chockenberry avatar Jun 07 '20 20:06 chockenberry

This should be fixed in 0e8512a17743ccf202335d125803fc77c6b67f9d. I'm going to do some more real world testing before I close this issue, but feel free to take a look and try it out.

chockenberry avatar Jun 14 '20 21:06 chockenberry