[CHORE] Update terminal-to-html dependency

- Update the `github.com/buildkite/terminal-to-html/v3` dependency from
version v3.10.1 to v3.13.0.
- Version v3.12.0 introduced an incompatible change, the return type of
`AsHTML` changed from `[]byte` to `string`. That same version also
introduced streaming mode
https://github.com/buildkite/terminal-to-html/pull/126, which allows us
to avoid reading the whole input into memory.
- Closes #4313
This commit is contained in:
Gusted 2024-07-04 13:37:54 +02:00
parent 741191a498
commit 3eb178db49
No known key found for this signature in database
GPG key ID: FD821B732837125F
3 changed files with 8 additions and 8 deletions

View file

@ -58,13 +58,13 @@ func (Renderer) CanRender(filename string, input io.Reader) bool {
// Render renders terminal colors to HTML with all specific handling stuff.
func (Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.Writer) error {
buf, err := io.ReadAll(input)
if err != nil {
screen := &trend.Screen{}
if _, err := io.Copy(screen, input); err != nil {
return err
}
buf = trend.Render(buf)
buf = bytes.ReplaceAll(buf, []byte("\n"), []byte(`<br>`))
_, err = output.Write(buf)
buf := screen.AsHTML()
buf = strings.ReplaceAll(buf, "\n", `<br>`)
_, err := output.Write([]byte(buf))
return err
}