some more fixes

This commit is contained in:
maddalax 2024-10-26 15:26:23 -05:00
parent 5ee5d956f0
commit 62599c22ea
2 changed files with 5 additions and 1 deletions

View file

@ -11,10 +11,12 @@ import (
"github.com/yuin/goldmark/renderer/html"
"io"
"io/fs"
"sync"
)
type Renderer struct {
cache map[string]string
lock sync.Mutex
}
func NewRenderer() *Renderer {
@ -22,6 +24,8 @@ func NewRenderer() *Renderer {
}
func (r *Renderer) RenderFile(source string, system fs.FS) string {
r.lock.Lock()
defer r.lock.Unlock()
if val, ok := r.cache[source]; ok {
return val
}

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-[90vw] md:max-w-3xl 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.Class("w-full flex flex-col prose max-w-[90vw] md:max-w-xl md:px-4 lg:max-w-4xl xl:max-w-5xl 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)),
),
)