diff options
author | Alan Pearce | 2024-05-28 16:42:08 +0200 |
---|---|---|
committer | Alan Pearce | 2024-05-28 16:42:08 +0200 |
commit | a2e6dd0ec7990b24f11e971462f9cdf1f5dc9fef (patch) | |
tree | 293c983c5b0642b475e6c184816f5cd344ae2a87 | |
parent | 287cfec3d2479415bf3b7069702dbdb8c87b1826 (diff) | |
download | website-a2e6dd0ec7990b24f11e971462f9cdf1f5dc9fef.tar.lz website-a2e6dd0ec7990b24f11e971462f9cdf1f5dc9fef.tar.zst website-a2e6dd0ec7990b24f11e971462f9cdf1f5dc9fef.zip |
Add support for pandoc-style fences
:::{#foo .bar} text ::: becomes <div id="foo" class="bar"> text </text>
-rw-r--r-- | go.mod | 1 | ||||
-rw-r--r-- | go.sum | 2 | ||||
-rw-r--r-- | internal/builder/posts.go | 2 | ||||
-rw-r--r-- | nix/gomod2nix.toml | 3 | ||||
-rw-r--r-- | templates/style.css | 10 |
5 files changed, 16 insertions, 2 deletions
diff --git a/go.mod b/go.mod index 75e64b9..797ddda 100644 --- a/go.mod +++ b/go.mod @@ -19,6 +19,7 @@ require ( github.com/gohugoio/hugo v0.126.1 github.com/otiai10/copy v1.14.0 github.com/pkg/errors v0.9.1 + github.com/stefanfritsch/goldmark-fences v1.0.0 github.com/sykesm/zap-logfmt v0.0.4 github.com/thessem/zap-prettyconsole v0.4.0 github.com/yuin/goldmark v1.7.1 diff --git a/go.sum b/go.sum index 89d14db..4aa3e98 100644 --- a/go.sum +++ b/go.sum @@ -224,6 +224,8 @@ github.com/spf13/afero v1.11.0 h1:WJQKhtpdm3v2IzqG8VMqrr6Rf3UYpEF239Jy9wNepM8= github.com/spf13/afero v1.11.0/go.mod h1:GH9Y3pIexgf1MTIWtNGyogA5MwRIDXGUr+hbWNoBjkY= github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= +github.com/stefanfritsch/goldmark-fences v1.0.0 h1:cAL9eFJx5AfODfzURJg/R4M0TdynZb4azpGtXebywCI= +github.com/stefanfritsch/goldmark-fences v1.0.0/go.mod h1:afDcGjekNr4uEUtTuDNmU+yPElZkv0bF2ASp+KoYsDk= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= diff --git a/internal/builder/posts.go b/internal/builder/posts.go index cfe4e6f..deae3e8 100644 --- a/internal/builder/posts.go +++ b/internal/builder/posts.go @@ -13,6 +13,7 @@ import ( "github.com/adrg/frontmatter" mapset "github.com/deckarep/golang-set/v2" "github.com/pkg/errors" + fences "github.com/stefanfritsch/goldmark-fences" "github.com/yuin/goldmark" "github.com/yuin/goldmark/extension" htmlrenderer "github.com/yuin/goldmark/renderer/html" @@ -46,6 +47,7 @@ var markdown = goldmark.New( extension.GFM, extension.Footnote, extension.Typographer, + &fences.Extender{}, ), ) diff --git a/nix/gomod2nix.toml b/nix/gomod2nix.toml index 83420ce..ff90dd6 100644 --- a/nix/gomod2nix.toml +++ b/nix/gomod2nix.toml @@ -116,6 +116,9 @@ schema = 3 [mod."github.com/spf13/cast"] version = "v1.6.0" hash = "sha256-hxioqRZfXE0AE5099wmn3YG0AZF8Wda2EB4c7zHF6zI=" + [mod."github.com/stefanfritsch/goldmark-fences"] + version = "v1.0.0" + hash = "sha256-Ei+FLtzyHEqz/ZUwHqtQMKHawglcHqcdXmIa8PLvqtc=" [mod."github.com/sykesm/zap-logfmt"] version = "v0.0.4" hash = "sha256-KXVFtOU54chusK8AhZrzrvbbNmzq1mNrhs/7OmO+huE=" diff --git a/templates/style.css b/templates/style.css index 8d21237..2db3a94 100644 --- a/templates/style.css +++ b/templates/style.css @@ -114,13 +114,18 @@ div.highlight code { color: unset; } -blockquote { +blockquote, +.aside { border-left: 1px solid #999; color: #222; padding-left: 20px; font-style: italic; } +.aside { + font-style: unset; +} + footer { padding: 25px; text-align: center; @@ -179,7 +184,8 @@ ul.h-feed li a:visited { color: #ddd; } - blockquote { + blockquote, + .aside { color: #ccc; } |