Update Headline rendering
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{{range .Sections}}
|
||||
{{if eq .Level 1}}<h1 id="{{.ID}}">{{.Heading}}{{if .EditURL}} <a href="{{.EditURL}}" class="btn btn-small">edit</a>{{end}}</h1>
|
||||
{{else if eq .Level 2}}<h2 id="{{.ID}}">{{.Heading}}{{if .EditURL}} <a href="{{.EditURL}}" class="btn btn-small">edit</a>{{end}}</h2>
|
||||
{{else}}<h3 id="{{.ID}}">{{.Heading}}{{if .EditURL}} <a href="{{.EditURL}}" class="btn btn-small">edit</a>{{end}}</h3>{{end}}
|
||||
{{else}}<h3 id="{{.ID}}">{{.Heading}}{{if .EditURL}} <a href="{{.EditURL}}" class="btn btn-small btn-float">edit</a>{{end}}</h3>{{end}}
|
||||
{{if .Body}}{{.Body}}{{end}}
|
||||
{{if .Photos}}
|
||||
<div class="photo-grid">
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
(function () {
|
||||
var content = document.querySelector('.content');
|
||||
if (!content) return;
|
||||
|
||||
var headings = content.querySelectorAll('h2, h3, h4');
|
||||
if (!headings.length) return;
|
||||
|
||||
headings.forEach(function (h) {
|
||||
if (!h.id) return;
|
||||
var a = document.createElement('a');
|
||||
a.href = '#' + h.id;
|
||||
a.className = 'heading-anchor';
|
||||
a.setAttribute('aria-label', 'Link to this section');
|
||||
a.textContent = '#';
|
||||
h.insertBefore(a, h.firstChild);
|
||||
});
|
||||
}());
|
||||
@@ -57,7 +57,6 @@
|
||||
{{end}}
|
||||
{{if or .Content .SpecialContent}}
|
||||
<script src="/_/page/content.js"></script>
|
||||
<script src="/_/page/anchors.js"></script>
|
||||
{{if not .SuppressTOC}}<script src="/_/page/toc.js"></script>{{end}}
|
||||
<script src="/_/page/tasks.js"></script>
|
||||
{{end}}
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
if (h.querySelector('a.btn')) return;
|
||||
var a = document.createElement('a');
|
||||
a.href = '?edit§ion=' + (i + 1);
|
||||
a.className = 'btn btn-small';
|
||||
a.className = 'btn btn-small btn-float';
|
||||
a.textContent = 'edit';
|
||||
h.appendChild(document.createTextNode(' '))
|
||||
h.appendChild(a);
|
||||
|
||||
+1
-1
@@ -21,7 +21,7 @@ document.addEventListener("DOMContentLoaded", function () {
|
||||
var a = document.createElement("a");
|
||||
a.href = "#" + h.id;
|
||||
var clone = h.cloneNode(true);
|
||||
clone.querySelectorAll(".btn, .muted, .heading-anchor, .dropdown").forEach(function (el) { el.remove(); });
|
||||
clone.querySelectorAll(".btn, .muted, .dropdown").forEach(function (el) { el.remove(); });
|
||||
a.textContent = clone.textContent.trim();
|
||||
li.appendChild(a);
|
||||
list.appendChild(li);
|
||||
|
||||
+8
-13
@@ -24,13 +24,10 @@
|
||||
--link-hover: #d6d24d;
|
||||
--danger: #c40141;
|
||||
--danger-hover: #d03467;
|
||||
/* Translucent scrim for badges/overlays sitting on top of media. */
|
||||
--overlay: rgba(0, 0, 0, 0.55);
|
||||
|
||||
--border: 1px solid var(--secondary);
|
||||
--border-dashed: 1px dashed var(--secondary);
|
||||
/* Subtle vertical rail for tree-nesting depth — quieter than --border so
|
||||
it reads as a guide, not a divider. */
|
||||
--border-guide: 1px solid var(--bg-panel-hover);
|
||||
|
||||
--space-1: 0.25rem;
|
||||
@@ -209,6 +206,7 @@ footer {
|
||||
.btn::after { content: "]"; color: var(--secondary); }
|
||||
.btn:hover { color: var(--primary-hover); }
|
||||
.btn-small { font-size: 0.8rem; font-weight: normal; vertical-align: middle; }
|
||||
.btn-float {float: right;}
|
||||
.btn-tool { padding: 0 0.15rem; }
|
||||
.btn-block {
|
||||
display: flex;
|
||||
@@ -268,7 +266,7 @@ footer {
|
||||
.content h4, .content h5, .content h6,
|
||||
main > h2 {
|
||||
color: var(--text);
|
||||
margin: 1.25rem 0 var(--space-2);
|
||||
margin: var(--space-5) 0 var(--space-2);
|
||||
line-height: 1.3;
|
||||
}
|
||||
.content h1 {
|
||||
@@ -276,7 +274,12 @@ main > h2 {
|
||||
border-bottom: var(--border-dashed);
|
||||
padding-bottom: var(--space-1);
|
||||
}
|
||||
.content h2, main > h2 { font-size: 1.4rem; }
|
||||
.content h1:first-child { margin-top: 0; }
|
||||
.content h2, main > h2 {
|
||||
font-size: 1.4rem;
|
||||
border-bottom: var(--border-dashed);
|
||||
padding-bottom: var(--space-1);
|
||||
}
|
||||
.content h3 { font-size: 1.15rem; }
|
||||
.content p { margin: var(--space-3) 0; }
|
||||
.content ul, .content ol { margin: var(--space-3) 0 var(--space-3) var(--space-5); }
|
||||
@@ -344,14 +347,6 @@ main > h2 {
|
||||
line-height: 1.4;
|
||||
}
|
||||
|
||||
a.heading-anchor {
|
||||
color: var(--text-muted);
|
||||
margin-right: 0.4em;
|
||||
font-weight: normal;
|
||||
text-decoration: none;
|
||||
}
|
||||
a.heading-anchor:hover { color: var(--primary-hover); }
|
||||
|
||||
/* === Data tables ===
|
||||
Shared style for the file listing, search-suggestion dropdown, and
|
||||
markdown content tables. .data-table-grid adds per-cell borders + a
|
||||
|
||||
Reference in New Issue
Block a user