diff --git a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift index 0904e4f19..64961deb6 100644 --- a/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift +++ b/ElementX/Sources/Other/HTMLParsing/AttributedStringBuilderV2.swift @@ -174,7 +174,10 @@ struct AttributedStringBuilderV2: AttributedStringBuilderProtocol { case "code", "pre": let preserveFormatting = preserveFormatting || tag == "pre" content = attributedString(element: childElement, documentBody: documentBody, preserveFormatting: preserveFormatting, listTag: listTag, listIndex: &childIndex, indentLevel: indentLevel) + + let fontPointSize = fontPointSize * 0.9 // Intentionally shrink code blocks by 10% content.setFontPreservingSymbolicTraits(UIFont.monospacedSystemFont(ofSize: fontPointSize, weight: .regular)) + content.addAttribute(.CodeBlock, value: true, range: NSRange(location: 0, length: content.length)) content.addAttribute(.backgroundColor, value: UIColor.compound._bgCodeBlock as Any, range: NSRange(location: 0, length: content.length)) diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-en-GB.png index 8ab6484b5..ceba8a6c9 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbe5650088750690bb31a4aaedbbee8e087222f86bf563fd3cb57e1a82f31e5e -size 1106686 +oid sha256:c5597aa7bd2475300acdbf32ff6bc5c0781ef773a4ccc9f50c93fed3f4d67378 +size 1112093 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-pseudo.png index 8ab6484b5..ceba8a6c9 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPad-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:bbe5650088750690bb31a4aaedbbee8e087222f86bf563fd3cb57e1a82f31e5e -size 1106686 +oid sha256:c5597aa7bd2475300acdbf32ff6bc5c0781ef773a4ccc9f50c93fed3f4d67378 +size 1112093 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-en-GB.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-en-GB.png index 6aedf2d0a..f68da278d 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-en-GB.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-en-GB.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52ad9c6b5db4c5e876ef28aa019a3a75395c00d606daf56b961a43f10c6ae378 -size 1281081 +oid sha256:c1ea06e567eb4549250863c7318003620a852d1144a993fd692500554c53bdb7 +size 1266526 diff --git a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-pseudo.png b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-pseudo.png index 6aedf2d0a..f68da278d 100644 --- a/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-pseudo.png +++ b/PreviewTests/Sources/__Snapshots__/PreviewTests/formattedBodyText.v2-iPhone-16-pseudo.png @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:52ad9c6b5db4c5e876ef28aa019a3a75395c00d606daf56b961a43f10c6ae378 -size 1281081 +oid sha256:c1ea06e567eb4549250863c7318003620a852d1144a993fd692500554c53bdb7 +size 1266526