diff --git a/Sources/HTMLStreamer/AttributedStringConverter.swift b/Sources/HTMLStreamer/AttributedStringConverter.swift index 4664e53..a287c4d 100644 --- a/Sources/HTMLStreamer/AttributedStringConverter.swift +++ b/Sources/HTMLStreamer/AttributedStringConverter.swift @@ -257,6 +257,7 @@ public struct AttributedStringConverter { } var attributes = [NSAttributedString.Key: Any]() + var paragraphStyle = configuration.paragraphStyle var currentFontTraits: FontTrait = [] for style in styleStack { switch style { @@ -273,19 +274,17 @@ public struct AttributedStringConverter { case .strikethrough: attributes[.strikethroughStyle] = NSUnderlineStyle.single.rawValue case .blockquote: - attributes[.paragraphStyle] = blockquoteParagraphStyle + paragraphStyle = blockquoteParagraphStyle currentFontTraits.insert(.italic) case .orderedList, .unorderedList: - attributes[.paragraphStyle] = listParagraphStyle + paragraphStyle = listParagraphStyle } } attributes[.font] = getFont(traits: currentFontTraits) attributes[.foregroundColor] = configuration.color - if !attributes.keys.contains(.paragraphStyle) { - attributes[.paragraphStyle] = configuration.paragraphStyle - } + attributes[.paragraphStyle] = paragraphStyle str.append(NSAttributedString(string: currentRun, attributes: attributes)) currentRun = ""