style fixes

This commit is contained in:
maddalax 2024-10-25 14:11:48 -05:00
parent 48968bac78
commit 4398eb1fdb
4 changed files with 13 additions and 5 deletions

View file

@ -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"),
),
),

View file

@ -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(`

View file

@ -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(

View file

@ -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)),
),
)