Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-25 11:16:11 +01:00

Construct screen

This commit is contained in:
Gusted 2024-09-06 20:24:51 +02:00
parent 0911ba8646
commit 912fe49ab3
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -58,13 +58,16 @@ 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 {
screen := &trend.Screen{}
screen, err := trend.NewScreen()
if err != nil {
return err
}
if _, err := io.Copy(screen, input); err != nil {
return err
}
buf := screen.AsHTML()
buf = strings.ReplaceAll(buf, "\n", `<br>`)
_, err := output.Write([]byte(buf))
_, err = output.Write([]byte(buf))
return err
}