sync: Use goldmark instead of blackfriday

This commit is contained in:
nemunaire 2022-05-19 12:45:32 +02:00
commit f690a4e1c8
5 changed files with 111 additions and 111 deletions

View file

@ -1,6 +1,7 @@
package sync
import (
"bytes"
"fmt"
"image"
"image/jpeg"
@ -13,7 +14,7 @@ import (
"unicode"
"github.com/gin-gonic/gin"
"github.com/russross/blackfriday/v2"
"github.com/yuin/goldmark"
"golang.org/x/image/draw"
"srs.epita.fr/fic-server/libfic"
@ -143,7 +144,13 @@ func BuildTheme(i Importer, tdir string) (th *fic.Theme, errs []string) {
if err != nil {
errs = append(errs, fmt.Sprintf("%q: overview.txt: an error occurs during markdown formating: %s", tdir, err))
}
th.Headline = string(blackfriday.Run([]byte(th.Headline)))
var buf bytes.Buffer
err := goldmark.Convert([]byte(th.Headline), &buf)
if err != nil {
errs = append(errs, fmt.Sprintf("%q: overview.txt: an error occurs during markdown formating of the headline: %s", tdir, err))
} else {
th.Headline = string(buf.Bytes())
}
}
if i.exists(path.Join(tdir, "heading.jpg")) {