Currently the formatter adds 2 newlines after heading blocks which is normally fine, but isn't quite right when the block is the last thing in the document. I added a test case fort this:
func testHeadingLineBreaks3() {
let markdown = "# Heading 1"
let attributedString = AttributedStringFormatter.format(markdown: markdown, attributes: Self.defaultMDAttrs)
XCTAssertFalse(attributedString.string.hasSuffix("\n\n"), attributedString.string)
}