Skip to content

Commit 43001b1

Browse files
committed
Strip code blocks from whisperified text
1 parent 4ef517f commit 43001b1

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

Diff for: Sources/D2Commands/Output/WhisperPostprocessor.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ struct WhisperPostprocessor: MessagePostprocessor {
3333
}
3434

3535
private func whisperify(string: String) -> String {
36-
string.replacing(#/(?<prefix>^|\n)(?<suffix>\S)/#) { "\($0.prefix)-# \($0.suffix)" }
36+
string
37+
.replacing(#/```\S*/#, with: "")
38+
.trimmingCharacters(in: .whitespacesAndNewlines)
39+
.replacing(#/(?<prefix>^|\n)(?<suffix>\S)/#) { "\($0.prefix)-# \($0.suffix)" }
3740
}
3841
}

0 commit comments

Comments
 (0)