From f98d0bde73e7a8cf99e7e00648a5bf633ce8c800 Mon Sep 17 00:00:00 2001 From: Thiago Kenji Okada Date: Wed, 21 Aug 2024 22:23:02 +0100 Subject: [PATCH] Revert "mataroa: render HTML instead of Markdown" This reverts commit 6f24bbe31e1a144de782f42da754d3d33b1bc790. --- blog.go | 3 +-- go.mod | 2 +- go.sum | 4 ++++ mataroa.go | 6 ++++-- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/blog.go b/blog.go index c18be7a..5edfb8f 100644 --- a/blog.go +++ b/blog.go @@ -39,7 +39,6 @@ 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/. @@ -222,7 +221,7 @@ func genRss(ps posts) string { md := goldmark.New(goldmark.WithExtensions( NewLinkRewriter(blogMainUrl, nil), extension.GFM, - highlighting.NewHighlighting(highlighting.WithStyle(highlightStyle)), + highlighting.NewHighlighting(highlighting.WithStyle("monokai")), )) var items []*feeds.Item diff --git a/go.mod b/go.mod index 49f9b62..697e826 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ 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 ) @@ -14,7 +15,6 @@ 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 90e2ca9..bdd2efd 100644 --- a/go.sum +++ b/go.sum @@ -20,12 +20,16 @@ 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 c120001..9f5a548 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,10 +122,12 @@ 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)), ), )