From 17bf01d323fdc793a7f20535269633ba6dba738b Mon Sep 17 00:00:00 2001
From: Aditya Telange <21258296+adityatelange@users.noreply.github.com>
Date: Sun, 18 Oct 2026 20:18:45 +0530
Subject: [PATCH] fix(toc): show toc for org mode headings spanning multiple
lines
closes #1872
---
layouts/_partials/toc.html | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/layouts/_partials/toc.html b/layouts/_partials/toc.html
index 800f9aab..4fc93565 100644
--- a/layouts/_partials/toc.html
+++ b/layouts/_partials/toc.html
@@ -1,4 +1,4 @@
-{{- $headers := findRE "(.|\n])+?" .Content -}}
+{{- $headers := findRE "(.|\n)+?" .Content -}}
{{- $has_headers := ge (len $headers) 1 -}}
{{- if $has_headers -}}
@@ -36,7 +36,7 @@
{{- /* strip id="" to leave xyz, no way to get regex capturing groups in hugo */ -}}
{{- $cleanedID := replace (replace $id "id=\"" "") "\"" "" }}
- {{- $header := replaceRE "((.|\n])+?)" "$1" $header -}}
+ {{- $header := replaceRE "((.|\n)+?)" "$1" $header | strings.TrimSpace -}}
{{- if ne $i 0 -}}
{{- $prevHeaderLevel := index (findRE "[1-6]" (index $headers (sub $i 1)) 1) 0 -}}