Skip to content

Commit

Permalink
fix(ansihtml): preserve newlines in stream output
Browse files Browse the repository at this point in the history
  • Loading branch information
bevzzz committed Jan 30, 2024
1 parent cab939a commit 99b6eaa
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions extension/adapter/ansi.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ import (
// [ansihtml]: https://github.com/robert-nix/ansihtml
func AnsiHtml(convert func([]byte) []byte) render.RenderCellFunc {
return func(w io.Writer, cell schema.Cell) (err error) {
// Wrapping in <pre> helps preserve parts of the original
// formatting such as newlines and tabs.
io.WriteString(w, "<pre>")
_, err = w.Write(convert(cell.Text()))
io.WriteString(w, "</pre>")
return
}
}

0 comments on commit 99b6eaa

Please sign in to comment.