Skip to content

Commit

Permalink
fix: remove HTML formatting causing strange display of inline code
Browse files Browse the repository at this point in the history
  • Loading branch information
sewera committed Dec 8, 2023
1 parent 8a79074 commit 4764995
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 14 deletions.
10 changes: 7 additions & 3 deletions renderer/internal/assert/extended.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package assert

import (
"fmt"
"github.com/blazejsewera/blog/renderer/postprocess"
"github.com/yosssi/gohtml"
"reflect"
"testing"
)
Expand All @@ -22,7 +22,11 @@ func EqualFields[T any](t testing.TB, expected T, actual T, fields ...string) {

func EqualHTML[T, R []byte | string](t testing.TB, expected T, actual R) bool {
t.Helper()
normalizedExpected := string(postprocess.FormatHTML([]byte(expected)))
normalizedActual := string(postprocess.FormatHTML([]byte(actual)))
normalizedExpected := formatHTML(string(expected))
normalizedActual := formatHTML(string(actual))
return Equal(t, normalizedExpected, normalizedActual)
}

func formatHTML(input string) string {
return gohtml.Format(input)
}
9 changes: 0 additions & 9 deletions renderer/postprocess/format.go

This file was deleted.

3 changes: 1 addition & 2 deletions renderer/render/save.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package render
import (
"fmt"
"github.com/blazejsewera/blog/renderer/internal/log"
"github.com/blazejsewera/blog/renderer/postprocess"
"os"
)

Expand All @@ -12,7 +11,7 @@ func save(targetFile string, rendered []byte, sourceFile string) error {
if err != nil {
return renderErr(sourceFile, err)
}
_, err = target.Write(postprocess.FormatHTML(rendered))
_, err = target.Write(rendered)
if err != nil {
return renderErr(sourceFile, err)
}
Expand Down

0 comments on commit 4764995

Please sign in to comment.