From f08db85f89f18b98d0a7c3896a02bd39a018a346 Mon Sep 17 00:00:00 2001 From: Diogo Tridapalli Date: Thu, 16 Jul 2020 21:25:22 -0300 Subject: [PATCH] Keep the URL attribute if there is custom style Signed-off-by: Diogo Tridapalli --- NSAttributedString+Markdown.m | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/NSAttributedString+Markdown.m b/NSAttributedString+Markdown.m index 7dc2893..f81de09 100644 --- a/NSAttributedString+Markdown.m +++ b/NSAttributedString+Markdown.m @@ -471,12 +471,11 @@ static void updateAttributedString(NSMutableAttributedString *result, NSString * NSURL *URL = [NSURL URLWithString:inlineLink]; if (URL) { replacementString = linkText; + NSMutableDictionary *dict = [@{ NSLinkAttributeName: URL } mutableCopy]; if (styleAttributes[MarkdownStyleLink]) { - replacementAttributes = styleAttributes[MarkdownStyleLink]; - } - else { - replacementAttributes = @{ NSLinkAttributeName: URL }; + [dict addEntriesFromDictionary:styleAttributes[MarkdownStyleLink]]; } + replacementAttributes = [dict copy]; replaceMarkers = YES; } }