<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<meta name="description" content="{{ description }}">
<meta property="og:title" content="{{ title }}">
<meta property="og:description" content="{{ description }}">
<meta property="og:type" content="article">
<meta property="og:url" content="{{ base_url }}/{{ slug }}">
<meta name="robots" content="index, follow">
<link rel="alternate" type="text/markdown" href="/api/v1/documents/{{ slug }}" title="Full document (markdown)">
<link rel="alternate" type="application/json" href="{{ base_url }}/api/v1/documents/{{ slug }}" />
<style>
:root {
--bg: #0d0d0d;
--bg-subtle: #1a1a1a;
--fg: #e0e0e0;
--fg-secondary: #a0a0a0;
--fg-muted: #666666;
--border: #2a2a2a;
--border-strong: #444444;
--accent: #00cc88;
--accent-hover: #00ffaa;
--link: #5599dd;
--link-visited: #8877bb;
--link-hover: #77bbff;
--code-bg: #1a1a1a;
--code-border: #333333;
--code-fg: #cccccc;
--mark-bg: #334400;
--table-stripe: #141414;
--shadow: rgba(0, 0, 0, 0.4);
--font-body: 'SF Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
--font-heading: 'SF Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
--font-mono: 'SF Mono', ui-monospace, SFMono-Regular, Consolas, 'Liberation Mono', Menlo, monospace;
--font-size: 0.9375rem;
--line-height: 1.7;
--max-width: 850px;
--space-xs: 0.25rem;
--space-sm: 0.5rem;
--space-md: 1rem;
--space-lg: 1.75rem;
--space-xl: 2.5rem;
--space-xxl: 4rem;
}
*, *::before, *::after { box-sizing: border-box; }
html {
font-size: 16px;
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
}
body {
margin: 0;
padding: 0;
background: var(--bg);
color: var(--fg);
font-family: var(--font-body);
font-size: var(--font-size);
line-height: var(--line-height);
overflow-wrap: break-word;
}
main {
max-width: var(--max-width);
margin: 0 auto;
padding: var(--space-xxl) var(--space-lg);
}
h1, h2, h3, h4, h5, h6 {
font-family: var(--font-heading);
font-weight: 700;
line-height: 1.2;
color: var(--accent);
margin-bottom: var(--space-sm);
}
h1 {
font-size: 1.75rem;
margin-top: 0;
margin-bottom: var(--space-lg);
border-bottom: 2px solid var(--accent);
padding-bottom: var(--space-sm);
}
h2 {
font-size: 1.25rem;
margin-top: var(--space-xxl);
color: var(--fg);
}
h3 {
font-size: 1.0625rem;
margin-top: var(--space-xl);
color: var(--fg-secondary);
}
h4, h5, h6 {
font-size: var(--font-size);
margin-top: var(--space-lg);
color: var(--fg-muted);
text-transform: uppercase;
letter-spacing: 0.1em;
}
p { margin: 0 0 var(--space-md); }
a {
color: var(--link);
text-decoration: none;
border-bottom: 1px solid transparent;
transition: border-color 0.15s;
}
a:visited { color: var(--link-visited); }
a:hover { border-bottom-color: var(--link-hover); color: var(--link-hover); }
ul, ol { margin: 0 0 var(--space-md); padding-left: 1.5em; }
li { margin: 0.3em 0; }
blockquote {
margin: var(--space-lg) 0;
padding: var(--space-sm) var(--space-lg);
border-left: 3px solid var(--accent);
background: var(--bg-subtle);
color: var(--fg-secondary);
}
blockquote p:last-child { margin-bottom: 0; }
code {
font-family: var(--font-mono);
font-size: 0.9em;
background: var(--code-bg);
color: var(--accent);
border: 1px solid var(--code-border);
border-radius: 3px;
padding: 0.1em 0.3em;
}
pre {
background: var(--code-bg);
border: 1px solid var(--code-border);
border-radius: 4px;
padding: var(--space-md);
overflow-x: auto;
margin: 0 0 var(--space-lg);
}
pre code {
background: none;
border: none;
padding: 0;
color: var(--code-fg);
font-size: 0.85rem;
line-height: 1.6;
}
table {
border-collapse: collapse;
width: 100%;
margin: var(--space-lg) 0;
font-size: 0.85rem;
}
thead { border-bottom: 2px solid var(--accent); }
th {
padding: var(--space-sm) var(--space-md);
text-align: left;
font-weight: 700;
color: var(--accent);
text-transform: uppercase;
letter-spacing: 0.05em;
font-size: 0.75rem;
}
td {
padding: var(--space-sm) var(--space-md);
border-bottom: 1px solid var(--border);
}
tbody tr:nth-child(even) { background: var(--table-stripe); }
table { display: block; overflow-x: auto; }
thead, tbody, tr, th, td { display: revert; }
td code, th code {
white-space: nowrap;
word-break: keep-all;
}
hr {
border: none;
height: 1px;
background: var(--border-strong);
margin: var(--space-xxl) 0;
}
img { max-width: 100%; height: auto; border-radius: 3px; }
footer {
max-width: var(--max-width);
margin: 0 auto;
padding: var(--space-lg);
text-align: center;
}
footer::before {
content: "";
display: block;
width: 2rem;
height: 1px;
background: var(--border);
margin: 0 auto var(--space-lg);
}
footer small {
color: var(--fg-muted);
font-size: 0.75rem;
font-family: var(--font-mono);
}
footer small a {
color: var(--link);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 2px;
transition: color 0.15s;
}
footer small a:hover {
color: var(--link-hover);
}
@media (max-width: 600px) {
:root { --font-size: 0.875rem; }
main { padding: var(--space-xl) var(--space-md); }
h1 { font-size: 1.4rem; }
}
::selection {
background: rgba(0, 204, 136, 0.3);
color: var(--fg);
}
.doc-toolbar {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 0.4rem;
margin-bottom: var(--space-lg);
flex-wrap: wrap;
}
.doc-btn {
display: inline-flex;
align-items: center;
gap: 0.25em;
padding: 0.2em 0.65em;
font-family: var(--font-heading);
font-size: 0.75rem;
font-weight: 450;
color: var(--fg-muted);
background: transparent;
border: 1px solid var(--border-strong);
border-radius: 999px;
cursor: pointer;
text-decoration: none;
transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
letter-spacing: 0.01em;
white-space: nowrap;
line-height: 1.6;
}
.doc-btn:hover {
color: var(--accent);
border-color: var(--accent);
background: var(--bg-subtle);
text-decoration: none;
}
.doc-btn:focus-visible {
outline: 2px solid var(--accent);
outline-offset: 2px;
}
.doc-toast {
position: fixed;
bottom: var(--space-lg);
right: var(--space-lg);
padding: 0.4em 0.85em;
background: var(--fg);
color: var(--bg);
font-family: var(--font-heading);
font-size: 0.8rem;
border-radius: 5px;
pointer-events: none;
opacity: 0;
transform: translateY(6px);
transition: opacity 0.18s ease, transform 0.18s ease;
z-index: 9999;
}
.doc-toast.doc-toast--visible {
opacity: 1;
transform: translateY(0);
}
.doc-expiry {
font-family: var(--font-heading);
font-size: 0.72rem;
color: var(--fg-muted);
letter-spacing: 0.01em;
white-space: nowrap;
margin-right: auto;
}
.doc-expiry.expiry-urgent {
color: #e57373;
}
@media print {
@page { margin: 2cm; }
body {
background: white !important;
color: black !important;
font-size: 11pt;
}
main {
max-width: none;
padding: 0;
}
h1, h2, h3, h4, h5, h6 {
color: black !important;
border-bottom-color: #ccc !important;
page-break-after: avoid;
}
a {
color: #1a1a1a !important;
text-decoration: underline;
border-bottom: none;
}
a[href^="http"]::after {
content: " (" attr(href) ")";
font-size: 0.8em;
color: #666;
}
pre[style] {
background: #f5f5f5 !important;
border: 1px solid #ddd !important;
}
pre span[style] {
color: #333 !important;
}
pre, code {
background: #f5f5f5 !important;
color: #333 !important;
border: 1px solid #ddd;
}
pre, blockquote, table {
page-break-inside: avoid;
}
blockquote {
background: #f9f9f9 !important;
color: #555 !important;
border-left-color: #999 !important;
}
.doc-toolbar, .doc-toast, .doc-expiry { display: none; }
}
</style>
</head>
<body>
<main>
<article>
<div class="doc-toolbar">
{% if let Some(exp) = expires_at %}
<div class="doc-expiry" data-expires="{{ exp }}">
<span class="expiry-label">Expires in </span><span class="expiry-countdown"></span>
</div>
{% endif %}
<button class="doc-btn" id="btn-copy-url" title="Copy link to clipboard">
Copy link
</button>
<button class="doc-btn" id="btn-copy-md" title="Copy markdown source to clipboard">
Copy markdown
</button>
<button class="doc-btn" id="btn-pdf" title="Save as PDF"{% if body_empty %} hidden{% endif %}>PDF</button>
<a class="doc-btn" id="btn-view-raw" href="#" title="View raw markdown source">
View raw
</a>
</div>
{{ content|safe }}
</article>
</main>
<footer>
<small>shared via <a href="https://github.com/gabaum10/twofold">twofold</a></small>
<div style="margin-top: 3rem; padding-top: 1rem; border-top: 1px solid rgba(128,128,128,0.2); font-size: 0.75rem; color: rgba(128,128,128,0.5);">
Full document: <a href="{{ base_url }}/api/v1/documents/{{ slug }}" style="color: inherit;">{{ base_url }}/api/v1/documents/{{ slug }}</a>
</div>
</footer>
<div class="doc-toast" id="doc-toast" aria-live="polite"></div>
<script>
(function () {
'use strict';
var toast = document.getElementById('doc-toast');
var toastTimer = null;
function showToast(msg) {
if (toastTimer) clearTimeout(toastTimer);
toast.textContent = msg;
toast.classList.add('doc-toast--visible');
toastTimer = setTimeout(function () {
toast.classList.remove('doc-toast--visible');
}, 2000);
}
var pathParts = window.location.pathname.replace(/^\//, '').split('/');
var slug = pathParts[0];
var rawUrl = window.location.origin + '/' + slug + '?raw=1';
document.getElementById('btn-view-raw').href = rawUrl;
document.getElementById('btn-copy-url').addEventListener('click', function () {
navigator.clipboard.writeText(window.location.href).then(function () {
showToast('Copied!');
}).catch(function () {
showToast('Copy failed');
});
});
document.getElementById('btn-copy-md').addEventListener('click', function () {
fetch('/' + slug + '?raw=1')
.then(function (r) { return r.text(); })
.then(function (text) {
return navigator.clipboard.writeText(text);
})
.then(function () {
showToast('Copied markdown!');
})
.catch(function () {
showToast('Copy failed');
});
});
var btnPdf = document.getElementById('btn-pdf');
if (btnPdf) {
btnPdf.addEventListener('click', function() {
window.print();
});
}
})();
(function() {
var el = document.querySelector('.doc-expiry');
if (!el) return;
var exp = new Date(el.dataset.expires);
function update() {
var now = new Date();
var diff = exp - now;
if (diff <= 0) {
el.querySelector('.expiry-countdown').textContent = 'expired';
el.classList.add('expired');
return;
}
var days = Math.floor(diff / 86400000);
var h = Math.floor((diff % 86400000) / 3600000);
var m = Math.floor((diff % 3600000) / 60000);
var text = '';
if (days > 0) {
text = days + (days === 1 ? ' day' : ' days');
if (h > 0) text += ', ' + h + (h === 1 ? ' hour' : ' hours');
} else if (h > 0) {
text = h + (h === 1 ? ' hour' : ' hours');
if (m > 0) text += ', ' + m + (m === 1 ? ' minute' : ' minutes');
} else {
text = (m > 0 ? m : 1) + (m === 1 ? ' minute' : ' minutes');
}
el.querySelector('.expiry-countdown').textContent = text;
if (diff < 300000) el.classList.add('expiry-urgent');
}
update();
setInterval(update, 1000);
})();
</script>
</body>
</html>