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