Skip to content

Commit

Permalink
Unify NSMutableParagraphStyle creation
Browse files Browse the repository at this point in the history
  • Loading branch information
tomekzaw committed Dec 22, 2024
1 parent a08da3b commit 3ced129
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apple/MarkdownFormatter.mm
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ - (void)applyRangeToAttributedString:(NSMutableAttributedString *)attributedStri
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:range];
[attributedString addAttribute:RCTLiveMarkdownBlockquoteDepthAttributeName value:@(depth) range:range];
} else if (type == "h1" && markdownStyle.h1LineHeight != -1) {
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
NSParagraphStyle *defaultParagraphStyle = defaultTextAttributes[NSParagraphStyleAttributeName];
NSMutableParagraphStyle *paragraphStyle = defaultParagraphStyle != nil ? [defaultParagraphStyle mutableCopy] : [NSMutableParagraphStyle new];
paragraphStyle.lineHeightMultiple = markdownStyle.h1LineHeight / markdownStyle.h1FontSize;
NSRange rangeWithHashAndSpace = NSMakeRange(range.location - 2, range.length + 2);
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:rangeWithHashAndSpace];
Expand Down

0 comments on commit 3ced129

Please sign in to comment.