From 03403186339abb58c5d4a720a5da23ddde66014b Mon Sep 17 00:00:00 2001 From: Kyren223 Date: Sat, 10 Oct 2026 03:26:11 +0300 Subject: Bunch more changes --- website.go | 65 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 61 insertions(+), 4 deletions(-) (limited to 'website.go') diff --git a/website.go b/website.go index b54030c..e64e7f8 100644 --- a/website.go +++ b/website.go @@ -7,6 +7,7 @@ import ( "encoding/json" "errors" "fmt" + "html" "html/template" "io/fs" "log" @@ -25,7 +26,7 @@ import ( "github.com/yuin/goldmark/ast" "github.com/yuin/goldmark/extension" "github.com/yuin/goldmark/parser" - "github.com/yuin/goldmark/renderer/html" + gmhtml "github.com/yuin/goldmark/renderer/html" "github.com/yuin/goldmark/text" "github.com/yuin/goldmark/util" "gopkg.in/yaml.v3" @@ -189,12 +190,39 @@ var md = goldmark.New( }), ), ), - goldmark.WithRendererOptions(html.WithUnsafe()), + goldmark.WithRendererOptions(gmhtml.WithUnsafe()), goldmark.WithParserOptions( parser.WithASTTransformers(util.Prioritized(externalLinks{}, 100)), ), ) +var tagRe = regexp.MustCompile(`<[^>]*>`) + +func ligatures(html string) string { + var out strings.Builder + depth, last := 0, 0 + apply := func(s string) string { + if depth == 0 { + return arrows.Replace(s) + } + return s + } + for _, loc := range tagRe.FindAllStringIndex(html, -1) { + out.WriteString(apply(html[last:loc[0]])) + tag := html[loc[0]:loc[1]] + switch { + case strings.HasPrefix(tag, " escaped + } + return strings.NewReplacer(args...) +} + +var arrows = newReplacer(map[string]string{ + // arrows + "->": "→", "<-": "←", "<->": "↔", + "-->": "⟶", "<--": "⟵", "<-->": "⟷", + "->>": "↠", "<<-": "↞", "|->": "↦", + "~>": "↝", "<~": "↜", + // double arrows + "=>": "⇒", "<=>": "⇔", + "==>": "⟹", "<==": "⟸", "<==>": "⟺", + // comparisons + ">=": "≥", "<=": "≤", "!=": "≠", "+-": "±", +}) + func openInNewTab(n ast.Node) { n.SetAttributeString("target", []byte("_blank")) n.SetAttributeString("rel", []byte("noopener noreferrer")) @@ -376,6 +431,7 @@ var projects = []Project{ Icon: IconCpu("text-[#F16265]"), Tags: []ProjectTag{ {"Zig", Color("text-[#D8C44B]")}, + {"Raylib", Color("text-[#FFFFFF]")}, }, Links: []ProjectLink{ {IconGit("text-[#F5A670]"), "Git", "https://git.kyren.codes/kyren/cpu-vs-ai.git"}, @@ -602,7 +658,8 @@ func main() { minecraft := FontPack{ Monospace: `Monocraft, JetBrains Mono, monospace`, - Normal: `Monocraft, Inter, system-ui, sans-serif`, + // Normal: `Inter, Lower Pixel Regular, Monocraft, system-ui, sans-serif`, + Normal: `LowerPixelRegular, Inter, system-ui, sans-serif`, } SetTheme("carbonight-cat", carbonightCat) -- cgit v1.3.1