From 6f24bbe31e1a144de782f42da754d3d33b1bc790 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Wed, 21 Aug 2024 22:05:11 +0100 Subject: [PATCH] mataroa: render HTML instead of Markdown --- blog.go | 3 ++- go.mod | 2 +- go.sum | 4 ---- mataroa.go | 6 ++---- 4 files changed, 5 insertions(+), 10 deletions(-) diff --git a/blog.go b/blog.go index 5edfb8f..c18be7a 100644 --- a/blog.go +++ b/blog.go @@ -39,6 +39,7 @@ const ( blogBaseUrl = "https://github.com/thiagokokada/blog" blogMainUrl = blogBaseUrl + "/blob/main/" blogRawUrl = blogBaseUrl + "/raw/main/" + highlightStyle = "monokai" readmeTemplate = `# Blog Mirror of my blog in https://kokada.capivaras.dev/. @@ -221,7 +222,7 @@ func genRss(ps posts) string { md := goldmark.New(goldmark.WithExtensions( NewLinkRewriter(blogMainUrl, nil), extension.GFM, - highlighting.NewHighlighting(highlighting.WithStyle("monokai")), + highlighting.NewHighlighting(highlighting.WithStyle(highlightStyle)), )) var items []*feeds.Item diff --git a/go.mod b/go.mod index 697e826..49f9b62 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,6 @@ require ( github.com/elliotchance/orderedmap/v2 v2.4.0 github.com/gorilla/feeds v1.2.0 github.com/gosimple/slug v1.14.0 - github.com/teekennedy/goldmark-markdown v0.3.0 github.com/yuin/goldmark v1.7.4 github.com/yuin/goldmark-highlighting v0.0.0-20220208100518-594be1970594 ) @@ -15,6 +14,7 @@ require ( github.com/alecthomas/chroma v0.10.0 // indirect github.com/dlclark/regexp2 v1.11.4 // indirect github.com/gosimple/unidecode v1.0.1 // indirect + gopkg.in/yaml.v3 v3.0.0 // indirect ) replace github.com/teekennedy/goldmark-markdown => github.com/thiagokokada/goldmark-markdown v0.0.0-20240820111219-f30775d8ed15 diff --git a/go.sum b/go.sum index bdd2efd..90e2ca9 100644 --- a/go.sum +++ b/go.sum @@ -20,16 +20,12 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/rhysd/go-fakeio v1.0.0 h1:+TjiKCOs32dONY7DaoVz/VPOdvRkPfBkEyUDIpM8FQY= -github.com/rhysd/go-fakeio v1.0.0/go.mod h1:joYxF906trVwp2JLrE4jlN7A0z6wrz8O6o1UjarbFzE= github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/thiagokokada/goldmark-markdown v0.0.0-20240820111219-f30775d8ed15 h1:a0JRZEKKoKhQWUi4BQm2QVugFZVZ6Y5ZtB9acRO0fQE= -github.com/thiagokokada/goldmark-markdown v0.0.0-20240820111219-f30775d8ed15/go.mod h1:kMhDz8La77A9UHvJGsxejd0QUflN9sS+QXCqnhmxmNo= github.com/yuin/goldmark v1.4.5/go.mod h1:rmuwmfZ0+bvzB24eSC//bk1R1Zp3hM0OXYv/G2LIilg= github.com/yuin/goldmark v1.7.4 h1:BDXOHExt+A7gwPCJgPIIq7ENvceR7we7rOS9TNoLZeg= github.com/yuin/goldmark v1.7.4/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= diff --git a/mataroa.go b/mataroa.go index 9f5a548..c120001 100644 --- a/mataroa.go +++ b/mataroa.go @@ -26,8 +26,8 @@ import ( "time" "github.com/elliotchance/orderedmap/v2" - markdown "github.com/teekennedy/goldmark-markdown" "github.com/yuin/goldmark" + highlighting "github.com/yuin/goldmark-highlighting" "github.com/yuin/goldmark/extension" ) @@ -122,12 +122,10 @@ func postMataroaPost(p post) (mataroaResponse, *http.Response, error) { func prepareToMataroa(ps posts) posts { md := goldmark.New( - goldmark.WithRenderer( - markdown.NewRenderer(markdown.WithSubListLength(2)), - ), goldmark.WithExtensions( NewLinkRewriter(mataroaBlogUrl, ps), extension.GFM, + highlighting.NewHighlighting(highlighting.WithStyle(highlightStyle)), ), )