diff --git a/htmgo-site/internal/markdown/render.go b/htmgo-site/internal/markdown/render.go index 8677ac9..0c8f216 100644 --- a/htmgo-site/internal/markdown/render.go +++ b/htmgo-site/internal/markdown/render.go @@ -2,6 +2,8 @@ package markdown import ( "bytes" + "github.com/alecthomas/chroma/v2" + chromahtml "github.com/alecthomas/chroma/v2/formatters/html" "github.com/yuin/goldmark" highlighting "github.com/yuin/goldmark-highlighting/v2" "github.com/yuin/goldmark/extension" @@ -52,6 +54,12 @@ func RenderMarkdown(reader io.Reader) bytes.Buffer { ), goldmark.WithExtensions( highlighting.NewHighlighting( + highlighting.WithFormatOptions( + chromahtml.WithLineNumbers(true), + chromahtml.WithCustomCSS(map[chroma.TokenType]string{ + chroma.PreWrapper: "padding: 12px; overflow: auto; background-color: rgb(245, 245, 245) !important;", + }), + ), highlighting.WithStyle("github"), ), ), diff --git a/htmgo-site/pages/base/root.go b/htmgo-site/pages/base/root.go index 0fd37e4..54d7a3c 100644 --- a/htmgo-site/pages/base/root.go +++ b/htmgo-site/pages/base/root.go @@ -38,7 +38,7 @@ func RootPage(ctx *h.RequestContext, children ...h.Ren) *h.Element { `), ), h.Body( - h.Class("bg-stone-50 h-screen"), + h.Class("bg-white h-screen"), h.Fragment(children...), h.Script("https://cdn.jsdelivr.net/npm/@docsearch/js@3"), h.UnsafeRawScript(` diff --git a/htmgo-site/pages/docs.go b/htmgo-site/pages/docs.go index c8a3572..c08fa78 100644 --- a/htmgo-site/pages/docs.go +++ b/htmgo-site/pages/docs.go @@ -31,11 +31,11 @@ func DocsPage(ctx *h.RequestContext) *h.Page { h.Class("w-full md:hidden bg-neutral-50 overflow-y-auto"), partials.DocSidebar(pages), ), - h.Class("overflow-y-auto justify-center md:mx-auto overflow-x-hidden pb-6"), + h.Class("overflow-y-auto justify-center overflow-x-hidden pb-6 items-center w-full"), h.Div( - h.Class("flex flex-col"), + h.Class("flex flex-col mx-auto"), h.Div( - h.Class("flex flex-col justify-center items-center md:mt-6 "), + h.Class("flex flex-col justify-center items-center md:mt-6 mx-auto"), h.List(pages, func(page *dirwalk.Page, index int) *h.Element { anchor := partials.CreateAnchor(page.Parts) return h.Div( diff --git a/htmgo-site/pages/markdown.go b/htmgo-site/pages/markdown.go index eff2c6a..8f2fcbb 100644 --- a/htmgo-site/pages/markdown.go +++ b/htmgo-site/pages/markdown.go @@ -25,7 +25,7 @@ func MarkdownContent(ctx *h.RequestContext, path string, id string) *h.Element { h.Id(id), ), h.Div( - h.Class("w-full flex flex-col prose max-w-md md:max-w-xl lg:max-w-3xl prose-code:text-black prose-p:my-1 prose:p-0 prose-li:m-0 prose-ul:m-0 prose-ol:m-0"), + h.Class("w-full flex flex-col prose max-w-md md:max-w-xl lg:max-w-4xl prose-code:text-black prose-p:my-1 prose:p-0 prose-li:m-0 prose-ul:m-0 prose-ol:m-0"), h.UnsafeRaw(renderer.RenderFile(path, embeddedMd)), ), )