Skip to content

Commit

Permalink
all nested quotes ranges starts in the beginning of line
Browse files Browse the repository at this point in the history
  • Loading branch information
robertKozik committed Feb 20, 2024
1 parent 0ac0e3d commit 45226e1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion ios/MarkdownLayoutManager.mm
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ - (void)drawBackgroundForGlyphRange:(NSRange)glyphsToShow atPoint:(CGPoint)origi
RCTMarkdownUtils *markdownUtils = [self valueForKey:@"markdownUtils"];
[markdownUtils.blockquoteRanges enumerateObjectsUsingBlock:^(NSValue *item, NSUInteger idx, BOOL * _Nonnull stop) {
NSRange range = [item rangeValue];
NSUInteger start = range.location - (nestingLevel * 2); // compensate for the `>` syntax which is not included in range (with optional space after `>`)
NSUInteger start = range.location;
NSUInteger end = start + range.length;
NSUInteger location = glyphRange.location;
if (location >= start && location < end) {
Expand Down
2 changes: 1 addition & 1 deletion ios/RCTMarkdownUtils.mm
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,11 @@ - (NSAttributedString *)parseMarkdown:(nullable NSAttributedString *)input
} else if ([type isEqualToString:@"blockquote"]) {
CGFloat indent = _markdownStyle.blockquoteMarginLeft + _markdownStyle.blockquoteBorderWidth + _markdownStyle.blockquotePaddingLeft;
NSMutableParagraphStyle *paragraphStyle = [NSMutableParagraphStyle new];
[_blockquoteRanges addObject:[NSValue valueWithRange:range]];
NSRange circumferencingRange = [self getCircumferencingBlockquoteRange:range];
int blockquoteNestLevel = [self getBlockquoteNestLevel:range];
paragraphStyle.firstLineHeadIndent = indent * blockquoteNestLevel;
paragraphStyle.headIndent = indent * blockquoteNestLevel;
[_blockquoteRanges addObject:[NSValue valueWithRange:circumferencingRange]];
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:circumferencingRange];
} else if ([type isEqualToString:@"pre"]) {
[attributedString addAttribute:NSForegroundColorAttributeName value:_markdownStyle.preColor range:range];
Expand Down

0 comments on commit 45226e1

Please sign in to comment.