diff --git a/internal/web/gist.go b/internal/web/gist.go index e53d064..698a0da 100644 --- a/internal/web/gist.go +++ b/internal/web/gist.go @@ -443,8 +443,9 @@ func gistJs(ctx echo.Context) error { js := `document.write('') document.write('%s') ` - js = fmt.Sprintf(js, cssUrl, - strings.Replace(htmlbuf.String(), "\n", `\n`, -1)) + content := strings.Replace(htmlbuf.String(), `\n`, `\\n`, -1) + content = strings.Replace(content, "\n", `\n`, -1) + js = fmt.Sprintf(js, cssUrl, content) ctx.Response().Header().Set("Content-Type", "application/javascript") return plainText(ctx, 200, js) }