From e6286fcc0688b7b38c412754edeae5742aec5d42 Mon Sep 17 00:00:00 2001 From: patakuti Date: Sat, 20 Jun 2026 08:47:14 +0900 Subject: [PATCH] Fix mermaid rendering, table width, and display math size - Fix mermaid not rendering when a saved theme is stored in localStorage: the theme restore script was calling mermaid.initialize({startOnLoad: false}), overriding the initial startOnLoad:true config. Changed to startOnLoad:false and explicit mermaid.run() in DOMContentLoaded. Also pinned mermaid CDN to v10 to avoid future breaking API changes. - Change table width from 100% to auto so column widths are sized by content rather than being distributed equally across the container. - Add font-size:0.9em and overflow-x:auto to .math.display to reduce display math size and support wide formulas on narrow screens. Co-Authored-By: Claude Sonnet 4.6 --- internal/template/css.go | 7 ++++++- internal/template/template.go | 5 +++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/template/css.go b/internal/template/css.go index c121830..f8857f2 100644 --- a/internal/template/css.go +++ b/internal/template/css.go @@ -45,11 +45,16 @@ body { margin: 0; padding: 0; } } .markdown-body table { border-collapse: collapse; - width: 100%; + width: auto; + table-layout: auto; } .markdown-body table th, .markdown-body table td { border: 1px solid; padding: 6px 13px; } +.math.display { + font-size: 0.9em; + overflow-x: auto; +} ` diff --git a/internal/template/template.go b/internal/template/template.go index e826d4b..f9ad5b3 100644 --- a/internal/template/template.go +++ b/internal/template/template.go @@ -90,7 +90,7 @@ const markdownPageTplHead = ` const markdownPageTplTail = ` - +
@@ -116,7 +116,7 @@ const markdownPageTplTail = `