-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdoc-template.php
More file actions
374 lines (324 loc) · 9.1 KB
/
doc-template.php
File metadata and controls
374 lines (324 loc) · 9.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
<?php
/**
* Bitcoin Echo — Document Template
*
* Template for rendering markdown documents.
* Variables provided by index.php:
* - $title: Document title
* - $content: Parsed HTML content from markdown
*/
// Set page metadata for header
$page_title = htmlspecialchars($title) . ' — Bitcoin Echo';
$page_description = htmlspecialchars($title) . ' — Bitcoin Echo: Build once. Build right. Stop.';
$active_nav = null; // Don't highlight nav on document pages
$show_donation = true; // Show donation section on document pages
// Include header
include __DIR__ . '/header.php';
?>
<style>
/* Document-specific styles */
main {
position: relative;
z-index: 1;
max-width: 750px;
margin: 0 auto;
padding: 8rem 2rem 4rem;
user-select: text;
}
/* Document Header */
.doc-header {
text-align: center;
margin-bottom: 4rem;
padding-bottom: 3rem;
border-bottom: 1px solid var(--color-border);
}
.doc-label {
font-family: var(--font-mono);
font-size: 0.75rem;
letter-spacing: 0.2em;
text-transform: uppercase;
color: var(--color-text-dim);
margin-bottom: 1rem;
display: block;
}
.doc-header h1 {
font-size: clamp(2rem, 5vw, 3rem);
font-weight: 400;
line-height: 1.2;
margin-bottom: 1rem;
}
.doc-subtitle {
font-style: italic;
color: var(--color-text-muted);
font-size: 1.125rem;
}
/* Article Content — Markdown Styling */
.doc-content {
font-size: 1.0625rem;
}
.doc-content h1,
.doc-content h2,
.doc-content h3,
.doc-content h4,
.doc-content h5,
.doc-content h6 {
position: relative;
scroll-margin-top: 6rem;
}
.doc-content h1 {
font-size: 2rem;
font-weight: 400;
margin: 3rem 0 1.5rem;
padding-bottom: 0.5rem;
border-bottom: 1px solid var(--color-border);
}
.doc-content h2 {
font-size: 1.5rem;
font-weight: 400;
margin: 2.5rem 0 1rem;
color: var(--color-text);
}
.doc-content h3 {
font-size: 1.25rem;
font-weight: 400;
margin: 2rem 0 0.75rem;
color: var(--color-text);
}
.doc-content h4 {
font-size: 1rem;
font-weight: 700;
margin: 1.5rem 0 0.5rem;
}
/* Header link icon on hover */
.doc-content h1::before,
.doc-content h2::before,
.doc-content h3::before,
.doc-content h4::before,
.doc-content h5::before,
.doc-content h6::before {
content: '🔗';
position: absolute;
left: -1.5rem;
top: 0;
opacity: 0;
transition: opacity 0.2s ease;
font-size: 0.875em;
line-height: inherit;
text-decoration: none;
user-select: none;
}
.doc-content h1:hover::before,
.doc-content h2:hover::before,
.doc-content h3:hover::before,
.doc-content h4:hover::before,
.doc-content h5:hover::before,
.doc-content h6:hover::before {
opacity: 0.5;
}
.doc-content h1[id]:hover,
.doc-content h2[id]:hover,
.doc-content h3[id]:hover,
.doc-content h4[id]:hover,
.doc-content h5[id]:hover,
.doc-content h6[id]:hover {
padding-left: 0.5rem;
margin-left: -0.5rem;
}
/* Copy feedback notification */
.header-copy-feedback {
display: inline-flex;
align-items: center;
gap: 0.375rem;
margin-left: 0.75rem;
font-family: var(--font-mono);
font-size: 0.75rem;
color: var(--color-text-muted);
opacity: 0;
pointer-events: none;
transition: opacity 0.3s ease;
vertical-align: middle;
}
.header-copy-feedback.show {
opacity: 1;
}
.header-copy-feedback::before {
content: '✓';
font-size: 0.875rem;
}
.doc-content p {
margin-bottom: 1.5rem;
color: var(--color-text-muted);
}
.doc-content p:first-of-type {
font-size: 1.125rem;
color: var(--color-text);
}
.doc-content strong {
color: var(--color-text);
font-weight: 700;
}
.doc-content em {
font-style: italic;
}
.doc-content a {
color: var(--color-accent);
text-decoration: underline;
text-underline-offset: 2px;
}
.doc-content a:hover {
text-decoration: none;
}
.doc-content ul,
.doc-content ol {
margin-bottom: 1.5rem;
padding-left: 1.5rem;
color: var(--color-text-muted);
}
.doc-content li {
margin-bottom: 0.5rem;
}
.doc-content li > ul,
.doc-content li > ol {
margin-top: 0.5rem;
margin-bottom: 0;
}
.doc-content blockquote {
margin: 2rem 0;
padding: 1.5rem 2rem;
border-left: 3px solid var(--color-accent);
background: linear-gradient(to right, var(--color-glow), transparent);
font-style: italic;
font-size: 1.125rem;
color: var(--color-text);
}
.doc-content blockquote p {
margin-bottom: 0;
color: var(--color-text);
}
.doc-content hr {
border: none;
border-top: 1px solid var(--color-border);
margin: 3rem 0;
}
.doc-content code {
font-family: var(--font-mono);
font-size: 0.875em;
background: var(--color-code-bg);
padding: 0.2em 0.4em;
border-radius: 3px;
}
.doc-content pre {
background: var(--color-code-bg);
border: 1px solid var(--color-border);
padding: 1.5rem;
overflow-x: auto;
margin: 1.5rem 0;
border-radius: 4px;
}
.doc-content pre code {
background: none;
padding: 0;
font-size: 0.8125rem;
line-height: 1.6;
}
.doc-content table {
width: 100%;
border-collapse: collapse;
margin: 1.5rem 0;
font-size: 0.9375rem;
}
.doc-content th,
.doc-content td {
text-align: left;
padding: 0.75rem;
border-bottom: 1px solid var(--color-border);
}
.doc-content th {
font-family: var(--font-mono);
font-size: 0.75rem;
letter-spacing: 0.05em;
text-transform: uppercase;
color: var(--color-text-dim);
font-weight: 400;
}
.doc-content td {
color: var(--color-text-muted);
}
/* Dark theme code backgrounds */
[data-theme="dark"] {
--color-code-bg: #161616;
}
/* Light theme code backgrounds */
[data-theme="light"] {
--color-code-bg: #e8e5e0;
}
/* Responsive */
@media (max-width: 600px) {
main {
padding: 7rem 1.5rem 3rem;
}
.doc-content h1::before,
.doc-content h2::before,
.doc-content h3::before,
.doc-content h4::before,
.doc-content h5::before,
.doc-content h6::before {
left: -1.25rem;
font-size: 0.75em;
}
.header-copy-feedback {
font-size: 0.6875rem;
margin-left: 0.5rem;
}
}
</style>
<main>
<article class="doc-content">
<?= $content ?>
</article>
</main>
<script>
// Header link functionality
document.querySelectorAll('.doc-content h1[id], .doc-content h2[id], .doc-content h3[id], .doc-content h4[id], .doc-content h5[id], .doc-content h6[id]').forEach(header => {
header.style.cursor = 'pointer';
header.style.position = 'relative';
// Create feedback element
const feedback = document.createElement('span');
feedback.className = 'header-copy-feedback';
feedback.textContent = 'Link Copied';
header.appendChild(feedback);
header.addEventListener('click', function(e) {
// Don't trigger if clicking on a link inside the header
if (e.target.tagName === 'A' || e.target.closest('a')) {
return;
}
const id = this.getAttribute('id');
if (id) {
const url = window.location.origin + window.location.pathname + '#' + id;
// Copy to clipboard
if (navigator.clipboard && navigator.clipboard.writeText) {
navigator.clipboard.writeText(url).then(() => {
// Show feedback
const feedbackEl = this.querySelector('.header-copy-feedback');
if (feedbackEl) {
feedbackEl.classList.add('show');
setTimeout(() => {
feedbackEl.classList.remove('show');
}, 1200);
}
}).catch(() => {
// Fallback: navigate to the anchor
window.location.hash = id;
});
} else {
// Fallback for browsers without clipboard API
window.location.hash = id;
}
}
});
});
</script>
<?php
// Include footer
include __DIR__ . '/footer.php';
?>