diff --git a/go.mod b/go.mod index 722cf29..3451454 100644 --- a/go.mod +++ b/go.mod @@ -3,10 +3,11 @@ module github.com/unrob/milpa go 1.20 require ( - git.rob.mx/nidito/chinampa v0.0.0-20230321041809-725347ec48c9 + git.rob.mx/nidito/chinampa v0.0.0-20230321062825-4c0d40c631cc github.com/alecthomas/chroma/v2 v2.5.0 github.com/alessio/shellescape v1.4.1 github.com/bmatcuk/doublestar/v4 v4.6.0 + github.com/charmbracelet/glamour v0.6.0 github.com/fatih/color v1.15.0 github.com/hashicorp/go-getter v1.7.1 github.com/sirupsen/logrus v1.9.0 @@ -27,7 +28,6 @@ require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect - github.com/charmbracelet/glamour v0.6.0 // indirect github.com/dlclark/regexp2 v1.8.1 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect diff --git a/go.sum b/go.sum index b112b00..93ddc32 100644 --- a/go.sum +++ b/go.sum @@ -179,8 +179,8 @@ cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuW cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= -git.rob.mx/nidito/chinampa v0.0.0-20230321041809-725347ec48c9 h1:mYcACK/DF2VXI+LYvEV/W7wU6h7Xx/JT6Ez9prYkxuA= -git.rob.mx/nidito/chinampa v0.0.0-20230321041809-725347ec48c9/go.mod h1:ImvF16HDuvzSgb1VYOlrw6v1Hy/QNNNr2drVetpEvsk= +git.rob.mx/nidito/chinampa v0.0.0-20230321062825-4c0d40c631cc h1:nTiIKFnHJ4SIyXGbBk56FJ2ZUzrJ9eA6Y/usXJoQ0gw= +git.rob.mx/nidito/chinampa v0.0.0-20230321062825-4c0d40c631cc/go.mod h1:ImvF16HDuvzSgb1VYOlrw6v1Hy/QNNNr2drVetpEvsk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= diff --git a/internal/docs/html.go b/internal/docs/html.go index 0d1a9d0..2576d6c 100644 --- a/internal/docs/html.go +++ b/internal/docs/html.go @@ -14,6 +14,7 @@ import ( "git.rob.mx/nidito/chinampa/pkg/command" "git.rob.mx/nidito/chinampa/pkg/render" chromahtml "github.com/alecthomas/chroma/v2/formatters/html" + "github.com/charmbracelet/glamour" "github.com/spf13/cobra" _c "github.com/unrob/milpa/internal/constants" "github.com/yuin/goldmark" @@ -22,6 +23,32 @@ import ( "github.com/yuin/goldmark/extension" ) +func stringptr(str string) *string { + return &str +} + +func init() { + var zero uint + glamour.NoTTYStyleConfig.Document.Margin = &zero + glamour.NoTTYStyleConfig.Document.StylePrimitive.Color = nil + + glamour.DarkStyleConfig.Document.Margin = &zero + glamour.DarkStyleConfig.Document.StylePrimitive.Color = nil + glamour.DarkStyleConfig.H1.StylePrimitive.Color = stringptr("#cefcd3") + glamour.DarkStyleConfig.H1.StylePrimitive.BackgroundColor = stringptr("#2b3c2d") + glamour.DarkStyleConfig.Heading.StylePrimitive.Color = stringptr("#c0e394") + glamour.DarkStyleConfig.Code.StylePrimitive.Color = stringptr("#96b452") + glamour.DarkStyleConfig.Code.StylePrimitive.BackgroundColor = stringptr("#132b17") + + glamour.LightStyleConfig.Document.Margin = &zero + glamour.LightStyleConfig.Document.StylePrimitive.Color = nil + glamour.LightStyleConfig.H1.StylePrimitive.Color = stringptr("#cefcd3") + glamour.LightStyleConfig.H1.StylePrimitive.BackgroundColor = stringptr("#2b3c2d") + glamour.LightStyleConfig.Heading.StylePrimitive.Color = stringptr("#12731D") + glamour.LightStyleConfig.Code.StylePrimitive.Color = stringptr("#12731D") + glamour.LightStyleConfig.Code.StylePrimitive.BackgroundColor = stringptr("#cee3c4") +} + //go:embed template.html var LayoutTemplate []byte