Skip to content

Commit

Permalink
treewide: remove goldmark-markdown, render HTML to Mataroa
Browse files Browse the repository at this point in the history
  • Loading branch information
thiagokokada committed Sep 12, 2024
1 parent e410a90 commit 745f936
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 1,071 deletions.
16 changes: 11 additions & 5 deletions blog.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (
"strings"
"time"

"github.com/alecthomas/chroma/formatters/html"
"github.com/elliotchance/orderedmap/v2"
"github.com/gorilla/feeds"
"github.com/gosimple/slug"
Expand Down Expand Up @@ -218,11 +219,16 @@ func genRss(ps posts) string {
Title: "kokada's blog",
Description: "# dd if=/dev/urandom of=/dev/brain0",
}
md := goldmark.New(goldmark.WithExtensions(
NewLinkRewriter(blogMainUrl, nil),
extension.GFM,
highlighting.NewHighlighting(highlighting.WithStyle("monokai")),
))
md := goldmark.New(
goldmark.WithExtensions(
NewLinkRewriter(blogMainUrl, nil),
extension.GFM,
highlighting.NewHighlighting(
highlighting.WithStyle("monokai"),
highlighting.WithFormatOptions(html.Standalone(true)),
),
),
)

var items []*feeds.Item
for el := ps.Back(); el != nil; el = el.Prev() {
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ module github.com/thiagokokada/blog
go 1.21

require (
github.com/alecthomas/chroma v0.10.0
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
)

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
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
11 changes: 7 additions & 4 deletions mataroa.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ import (
"os"
"time"

"github.com/alecthomas/chroma/formatters/html"
"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"
)

Expand Down Expand Up @@ -122,12 +123,14 @@ 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(
// No style since we are reusing the style from
// Mataroa
highlighting.WithFormatOptions(html.WithClasses(true)),
),
),
)

Expand Down
1 change: 0 additions & 1 deletion vendor/github.com/teekennedy/goldmark-markdown/.gitignore

This file was deleted.

25 changes: 0 additions & 25 deletions vendor/github.com/teekennedy/goldmark-markdown/LICENSE

This file was deleted.

177 changes: 0 additions & 177 deletions vendor/github.com/teekennedy/goldmark-markdown/README.md

This file was deleted.

Loading

0 comments on commit 745f936

Please sign in to comment.