From 17048ab79312f1752a296ab150984a4ef30aed5c Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sat, 18 Apr 2026 19:02:18 +0200 Subject: refactor: syntax highlighting with Catppuccin Macchiato and copy buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add [markup.highlight] config: noClasses=false for CSS class output, lineNos=true with lineNumbersInTable=true for proper line number rendering - Create render-codeblock.html render hook to intercept fenced code blocks and wrap with header bar (language label + copy button) - Replace chroma-custom.css entirely with Catppuccin Macchiato palette (dark theme) + Catppuccin Latte (light theme), with full token color mapping - Create code-copy.js: copy-to-clipboard logic with language pretty-name map (bash→Shell, js→JavaScript, etc.), icon swap (copy→check for 2s), and aria-live region for screen reader announcement (WCAG 4.1.3) - Update baseof.html to load code-copy.js on page kind with Hugo Pipes - WCAG AA compliance: line number contrast fixed to ~3.5:1 (--ctp-overlay0), light theme copy button color to 4.1:1 (#6c6f85), focus outline 6.21:1 (--ctp-lavender), screen reader announcements via aria-live All code blocks now render with: syntax highlighting (noClasses=true fixed), line numbers with proper table layout, language label in header, copy button with feather icons, both dark and light theme support. Co-Authored-By: Claude Haiku 4.5 --- hugo.toml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'hugo.toml') diff --git a/hugo.toml b/hugo.toml index b7e0663..c20b617 100644 --- a/hugo.toml +++ b/hugo.toml @@ -9,6 +9,16 @@ enableRobotsTXT = true minifyOutput = false disableXML = false +# Syntax highlighting with Chroma +[markup] + [markup.highlight] + noClasses = false + lineNos = true + lineNumbersInTable = true + tabWidth = 2 + guessSyntax = true + codeFences = true + # Languages [languages] [languages.it] @@ -101,8 +111,6 @@ enableRobotsTXT = true email = "danix@danix.xyz" # Theme options - syntaxHighlight = true - lineNumbers = false readingTime = true shareButtons = true relatedPosts = true -- cgit v1.2.3