You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've noticed that the formatting has been putting in extra newlines when wrapping text that contains inline code blocks. I've included a test below that illustrates the problem; both tests fail, but in particular the first fails because there is an extra newline preceding contributesBlockIndent in the output:
fileprivate func markdownFormat(_ text: String, _ maxLength: Int) -> String {
let document = Document(parsing: text, options: .disableSmartOpts)
let lineLimit = MarkupFormatter.Options.PreferredLineLimit(
maxLength: maxLength,
breakWith: .softBreak
)
let formatterOptions = MarkupFormatter.Options(
orderedListNumerals: .incrementing(start: 1),
useCodeFence: .always,
condenseAutolinks: false,
preferredLineLimit: lineLimit
)
let output = document.format(options: formatterOptions)
return output
}
@Test func testInlineCodeWrapping() {
let str = """
This indent is applied independently of `contributesBlockIndent`, which means a given break \
may apply both a continuation indent and a block indent, either indent, or neither indent.
"""
let expected = """
This indent is applied independently of
`contributesBlockIndent`, which means a given break
may apply both a continuation indent and a block
indent, either indent, or neither indent.
"""
// format it twice; we want (a) the first version to be correct, and (b) the second version to be the same
let trip1 = markdownFormat(str, 55)
let trip2 = markdownFormat(trip1, 55)
#expect(trip1 == expected)
#expect(trip1 == trip2)
}
The text was updated successfully, but these errors were encountered:
I've noticed that the formatting has been putting in extra newlines when wrapping text that contains inline code blocks. I've included a test below that illustrates the problem; both tests fail, but in particular the first fails because there is an extra newline preceding
contributesBlockIndent
in the output:The text was updated successfully, but these errors were encountered: