diff --git a/platform/ios/Bypass/Bypass/BPAttributedStringConverter.m b/platform/ios/Bypass/Bypass/BPAttributedStringConverter.m index 7f7d62fb..35002e5c 100644 --- a/platform/ios/Bypass/Bypass/BPAttributedStringConverter.m +++ b/platform/ios/Bypass/Bypass/BPAttributedStringConverter.m @@ -22,6 +22,7 @@ #import "BPAttributedStringConverter.h" #import "BPDisplaySettings.h" #import "BPImageGetter.h" +#include "markdown.h" NSString *const BPLinkStyleAttributeName = @"NSLinkAttributeName"; @@ -375,10 +376,19 @@ - (void)renderListItemElement:(BPElement *)element NSFontAttributeName : [_displaySettings monospaceFont], NSForegroundColorAttributeName : bulletColor }; - - NSAttributedString *attributedBullet; - attributedBullet = [[NSAttributedString alloc] initWithString:@"• " - attributes:bulletAttributes]; + + NSString *bullet = @"• "; + NSString *flags = element.parentElement[@"flags"]; + if (flags != nil && ([flags integerValue] & MKD_LIST_ORDERED)) { + NSUInteger liNumber = 1 + [element.parentElement.childElements indexOfObject: element]; + bullet = [NSString stringWithFormat: @"%lu. ", (unsigned long)liNumber]; + bulletAttributes = @{ + NSFontAttributeName : [_displaySettings defaultFont], + NSForegroundColorAttributeName : [_displaySettings defaultColor] + }; + } + NSAttributedString *attributedBullet = [[NSAttributedString alloc] initWithString: bullet + attributes: bulletAttributes]; [target insertAttributedString:attributedBullet atIndex:effectiveRange.location];