Automatically add insert a new line after headers

This commit is contained in:
Stefan Ceriu
2025-09-10 09:37:26 +03:00
committed by Stefan Ceriu
parent cec4668705
commit 7d59589892
2 changed files with 6 additions and 5 deletions

View File

@@ -122,6 +122,7 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol {
let level = max(3, Int(String(tag.dropFirst())) ?? 1)
let size: CGFloat = fontPointSize + CGFloat(6 - level) * 2
content = attributedString(from: childElement, preserveFormatting: preserveFormatting, listTag: listTag, listIndex: &childIndex, indentLevel: indentLevel)
content.append(NSAttributedString(string: "\n"))
content.setFontPreservingSymbolicTraits(UIFont.boldSystemFont(ofSize: size))
case "p", "div":

View File

@@ -28,11 +28,11 @@ enum HTMLFixtures: String, CaseIterable {
"""
case .headers:
"""
<h1>H1 Header</h1></br>
<h2>H2 Header</h2></br>
<h3>H3 Header</h3></br>
<h4>H4 Header</h4></br>
<h5>H5 Header</h5></br>
<h1>H1 Header</h1>
<h2>H2 Header</h2>
<h3>H3 Header</h3>
<h4>H4 Header</h4>
<h5>H5 Header</h5>
<h6>H6 Header</h6>
"""
case .paragraphs: