9494
9595 # Styles (grid layout + sidebar + nice TOC)
9696 CSS='<style>
97- html, body { width:100%; max-width:none; margin:0; padding:0; font-family: Arial, Helvetica, sans-serif; color:#222; }
97+ html, body { width:100%; max-width:none; margin:0; padding:0; font-family: Arial, Helvetica, sans-serif; color:#222; line-height: 1.5; }
9898 h1, h2, h3, h4, h5, h6 { font-family: Arial, Helvetica, sans-serif; }
9999 pre code { display:block; padding:.75em; background:#f6f8fa; border-radius:6px; font-size:90%; overflow:auto; }
100100 code { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace; }
@@ -109,14 +109,15 @@ jobs:
109109 .sidebar nav.toc li { margin:4px 0; }
110110 .sidebar nav.toc a { color:#24292f; text-decoration:none; }
111111 .sidebar nav.toc a:hover { text-decoration:underline; }
112+ .sidebar .nav-label { margin-top: 1em; margin-bottom: .5em; font-size: 15px; color: #444; }
112113
113114 /* TOC indentation rules */
114115 .sidebar nav.toc ul ul { padding-left:14px; border-left:2px solid #e5e7eb; margin-left:6px; }
115116 .sidebar nav.toc ul ul ul { padding-left:14px; margin-left:6px; }
116117 .sidebar nav.toc ul ul ul ul { padding-left:14px; margin-left:6px; }
117118
118119 .content { width:100%; }
119- .container { width:100%; max-width: 1000px ; margin:0 auto; padding:48px; }
120+ .container { width:100%; max-width: 900px ; margin:0 auto; padding:48px; }
120121
121122 .extras { margin-top: 48px; }
122123 .extras h2, .extras h3 { margin-top: 1.2em; }
@@ -155,17 +156,22 @@ jobs:
155156 mv "$TMP" index.html
156157 fi
157158
158- # === Sidebar wrapper with Home + placeholder for TOC links ===
159+ # === Sidebar wrapper with Home + Navigation label + placeholder for TOC links ===
159160 HOMELINK="https://democracy-lab.github.io/"
160161 if grep -qi '<div class="page"' index.html; then
161- echo "Wrapper already present; skipping."
162+ echo "Wrapper already present; ensuring Navigation label exists."
163+ # If the label is missing, insert it immediately before <nav class="toc">
164+ if ! grep -qi '<h3[^>]*class="[^"]*nav-label[^"]*"' index.html; then
165+ perl -0777 -pe 's|(<aside\s+class="sidebar"[^>]*>\s*(?:(?!</aside>).)*?<a\s+class="home"[^>]*>.*?</a>\s*)(<nav\s+class="toc")|$1<h3 class="nav-label">Navigation:</h3>\n<$2|si' -i index.html
166+ fi
162167 else
163168 awk -v home="$HOMELINK" 'BEGIN{IGNORECASE=1}
164169 {
165170 if (!done && match(tolower($0), /<body[^>]*>/)) {
166171 sub(/<body[^>]*>/,
167172 "&\n<div class=\"page\"><aside class=\"sidebar\">" \
168173 "<a class=\"home\" href=\"" home "\" aria-label=\"Go to home\">← Home</a>" \
174+ "<h3 class=\"nav-label\">Navigation:</h3>" \
169175 "<nav class=\"toc\"><!--SIDEBAR_LINKS--></nav>" \
170176 "</aside>\n<main class=\"content\"><div class=\"container\">");
171177 done=1
@@ -354,3 +360,4 @@ jobs:
354360
355361
356362
363+
0 commit comments