Minor fixes for TOC

This commit is contained in:
2026-04-23 11:03:33 +02:00
parent 4751a99e8e
commit c6a292754f
2 changed files with 5 additions and 6 deletions
+3 -1
View File
@@ -20,7 +20,9 @@
li.className = "toc-" + h.tagName.toLowerCase();
var a = document.createElement("a");
a.href = "#" + h.id;
a.textContent = h.textContent;
var clone = h.cloneNode(true);
clone.querySelectorAll(".btn, .muted").forEach(function (el) { el.remove(); });
a.textContent = clone.textContent.trim();
li.appendChild(a);
list.appendChild(li);
});
+2 -5
View File
@@ -483,17 +483,14 @@ func renderDiaryMonth(fsPath, urlPath string) template.HTML {
for _, dayNum := range days {
date := time.Date(year, time.Month(monthNum), dayNum, 0, 0, 0, 0, time.UTC)
heading := formatGermanDate(date)
heading := date.Format("2006-01-02")
dayURL := path.Join(urlPath, fmt.Sprintf("%02d", dayNum)) + "/"
var content template.HTML
if dirName, ok := dayDirs[dayNum]; ok {
dayURL = path.Join(urlPath, dirName) + "/"
dayFsPath := filepath.Join(fsPath, dirName)
if raw, err := os.ReadFile(filepath.Join(dayFsPath, "index.md")); err == nil && len(raw) > 0 {
if h := extractFirstHeading(raw); h != "" {
heading = h
raw = stripFirstHeading(raw)
}
raw = stripFirstHeading(raw)
content = renderMarkdown(raw)
}
}