Spaces:
Running
Running
File size: 15,746 Bytes
ec7ac2b ec72d06 6ce049b ec7ac2b 004e4d7 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b ec72d06 ec7ac2b | 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 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 | <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Formatting Debug</title>
<!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.css" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/katex.min.js" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.11/dist/contrib/auto-render.min.js" crossorigin="anonymous"
onload="renderMathInElement(document.body,{delimiters:[{left:'$$',right:'$$',display:true},{left:'$',right:'$',display:false}],throwOnError:false});"></script>
<!-- Your stylesheet -->
<link rel="stylesheet" href="../style.css">
</head>
<body>
<script type="module" src="../summarize.js" defer></script><script src="../script.js" defer></script>
<div class="background"></div>
<main class="article">
<a class="back" href="../index.html">← Back</a>
<div class="meta">June 2026 · Debug</div>
<h1>Formatting Debug Post</h1>
<p>This is a throwaway post to verify every element renders the way
<code>style.css</code> intends. If something below looks off, that's the
bug — not a feature.</p>
<h2>Headings</h2>
<h3>Heading level 3</h3>
<h4>Heading level 4</h4>
<h2>Inline Formatting</h2>
<p>You can write <strong>strong</strong>, <em>emphasized</em>,
<strong><em>strong + emphasized</em></strong>, <mark>highlighted</mark>,
and <kbd>Cmd</kbd> + <kbd>K</kbd> text. Here is an inline
<code>variable_name</code> for good measure, plus a
<a href="https://huggingface.co">link to the Hub</a> and a long
<a href="https://huggingface.co/spaces/seton-labs/blog">https://huggingface.co/spaces/seton-labs/blog/with/a/very/long/url/that/might/overflow</a>
to test <code>overflow-wrap</code>.</p>
<h2>Blockquote</h2>
<blockquote>
This is a blockquote. It should show a thin accent bar on the left
and render in italic, per the stylesheet.
</blockquote>
<h2>Lists</h2>
<p>Unordered:</p>
<ul>
<li>First item</li>
<li>Second item with a nested list
<ul>
<li>Nested item A</li>
<li>Nested item B</li>
</ul>
</li>
<li>Third item</li>
</ul>
<p>Ordered:</p>
<ol>
<li>Step one</li>
<li>Step two</li>
<li>Step three</li>
</ol>
<h2>Code Block — Python</h2>
<pre><code>def greet(name: str) -> str:
"""Return a friendly greeting."""
return f"Hello, {name}!"
# Call the function
print(greet("Seton"))</code></pre>
<h2>Code Block — JavaScript</h2>
<pre><code>const train = async (model, data, epochs = 10) => {
for (let i = 0; i < epochs; i++) {
const loss = model.forward(data);
model.backward(loss);
console.log(`Epoch ${i + 1}/${epochs} — loss: ${loss.toFixed(4)}`);
}
return model;
};
// Usage
const result = await train(myModel, dataset, 20);</code></pre>
<h2>Table</h2>
<table>
<thead>
<tr><th>Element</th><th>Styled?</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td>Headings</td><td>Yes</td><td>Fluid type on h1/h2</td></tr>
<tr><td>Blockquote</td><td>Yes</td><td>Accent left border</td></tr>
<tr><td>Code</td><td>Yes</td><td>Syntax highlighted</td></tr>
<tr><td>Math</td><td>Yes</td><td>KaTeX rendering</td></tr>
<tr><td>Images</td><td>Yes</td><td>Click to enlarge</td></tr>
</tbody>
</table>
<h2>Images</h2>
<p>Click any image to enlarge. Use the side arrows to navigate between all images on this page.</p>
<p><img src="https://picsum.photos/seed/seton-debug/800/360" alt="Placeholder test image"></p>
<h2>More Images</h2>
<p>A couple more to test the lightbox navigation.</p>
<p><img src="https://picsum.photos/seed/seton-two/800/400" alt="Second test image"></p>
<p><img src="https://picsum.photos/seed/seton-three/800/400" alt="Third test image"></p>
<h2>Horizontal Rule</h2>
<p>Text above the rule.</p>
<hr>
<p>Text below the rule.</p>
<h2>Collapsible Section</h2>
<details>
<summary>Click to expand (testing <details>)</summary>
<p>Hidden body text. Useful for long appendices or changelogs.</p>
</details>
<h2>Math</h2>
<p>Inline math: the cross-entropy loss is $L = -\sum_{i=1}^{N} \log p(y_i \mid x_i)$. Block math — the gradient descent update rule:</p>
<p>$$ \theta_{t+1} = \theta_t - \eta \, \nabla_\theta \mathcal{L}(\theta_t) $$</p>
<p>And Bayes' theorem for good measure:</p>
<p>$$ P(\theta \mid \mathcal{D}) = \frac{P(\mathcal{D} \mid \theta) \, P(\theta)}{P(\mathcal{D})} $$</p>
<h2>Edge Cases</h2>
<p>A verylongunbrokenstringwithoutanyspacesAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA to test overflow handling.</p>
<p>Emoji test: 🤗 ✅ ❌ 🚀 🧪 — should render in color at body size.</p>
</main>
<script>
/* ==========================================================
SYNTAX HIGHLIGHTING
========================================================== */
const PY_KW = new Set([
'def','class','return','if','elif','else','for','while','import','from','as',
'try','except','finally','with','yield','lambda','pass','break','continue',
'raise','and','or','not','in','is','global','nonlocal','assert','del',
'async','await'
]);
const JS_KW = new Set([
'const','let','var','function','return','if','else','for','while','do',
'switch','case','break','continue','new','class','extends','import','export',
'from','default','try','catch','finally','throw','typeof','instanceof',
'in','of','async','await','yield','void','delete','with'
]);
const PY_BI = new Set([
'print','len','range','int','str','float','list','dict','set','tuple','bool',
'type','isinstance','input','open','map','filter','zip','enumerate','sorted',
'reversed','sum','min','max','abs','round','any','all','super','property',
'staticmethod','classmethod','True','False','None','Exception','ValueError',
'TypeError','KeyError','IndexError','AttributeError','NotImplementedError',
'RuntimeError','StopIteration','FileNotFoundError','object'
]);
const JS_BI = new Set([
'console','Math','Array','Object','String','Number','Boolean','Date','RegExp',
'Error','TypeError','RangeError','SyntaxError','JSON','Promise','Map','Set',
'Symbol','Proxy','Reflect','parseInt','parseFloat','isNaN','isFinite',
'undefined','null','true','false','NaN','Infinity'
]);
function escapeHtml(s) {
return s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
}
function detectLang(code) {
let py = 0, js = 0;
const pyP = /\b(def |class |import |from \w+ import|elif |print\(|True|False|None|self[\.\[])\b/g;
const jsP = /\b(const |let |var |function |=>|console\.|undefined|null|async |await )\b/g;
let m;
while ((m = pyP.exec(code)) !== null) py++;
while ((m = jsP.exec(code)) !== null) js++;
if (py > js) return 'python';
if (js > 0) return 'javascript';
return 'text';
}
function highlight(code) {
const lang = detectLang(code);
const kw = lang === 'python' ? PY_KW : lang === 'javascript' ? JS_KW : new Set();
const bi = lang === 'python' ? PY_BI : lang === 'javascript' ? JS_BI : new Set();
const tokens = [];
let i = 0;
const len = code.length;
while (i < len) {
if (lang === 'python') {
const t3 = code.slice(i, i + 3);
if (t3 === '"""' || t3 === "'''") {
const end = code.indexOf(t3, i + 3);
const span = end !== -1 ? code.slice(i, end + 3) : code.slice(i);
tokens.push({ type: 'string', text: span });
i += span.length;
continue;
}
}
{
const pm = code.slice(i).match(/^[frbFRB]{0,3}/);
if (pm) {
const pLen = pm[0].length;
const nc = code[i + pLen];
if (nc === '"' || nc === "'") {
const q = nc;
const isF = pm[0].toLowerCase().includes('f');
let depth = 0, k = i + pLen + 1;
let found = false;
while (k < len) {
const ch = code[k];
if (ch === '\\') { k += 2; continue; }
if (isF) {
if (ch === '{') { depth++; k++; continue; }
if (ch === '}') { depth = Math.max(0, depth - 1); k++; continue; }
}
if (ch === q && depth === 0) { found = true; break; }
k++;
}
if (found) {
tokens.push({ type: 'string', text: code.slice(i, k + 1) });
i = k + 1;
continue;
}
}
}
}
if (lang === 'python' && code[i] === '#') {
let end = code.indexOf('\n', i);
if (end === -1) end = len;
tokens.push({ type: 'comment', text: code.slice(i, end) });
i = end;
continue;
}
if (lang === 'javascript' && code.slice(i, i + 2) === '//') {
let end = code.indexOf('\n', i);
if (end === -1) end = len;
tokens.push({ type: 'comment', text: code.slice(i, end) });
i = end;
continue;
}
if (lang === 'javascript' && code.slice(i, i + 2) === '/*') {
let end = code.indexOf('*/', i + 2);
if (end === -1) end = len; else end += 2;
tokens.push({ type: 'comment', text: code.slice(i, end) });
i = end;
continue;
}
{
const m = code.slice(i).match(
/^(0x[0-9a-fA-F_]+|0b[01_]+|0o[0-7_]+|\d[\d_]*\.?\d*(?:e[+-]?\d+)?)/
);
if (m) {
tokens.push({ type: 'number', text: m[0] });
i += m[0].length;
continue;
}
}
if (lang === 'python' && code[i] === '@') {
const m = code.slice(i).match(/^@[\w.]+/);
if (m) {
tokens.push({ type: 'decorator', text: m[0] });
i += m[0].length;
continue;
}
}
{
const m = code.slice(i).match(/^\w+/);
if (m) {
const w = m[0];
let type = 'plain';
if (kw.has(w)) type = 'keyword';
else if (bi.has(w)) type = 'builtin';
else if (w === 'self' || w === 'cls' || w === 'this') type = 'self';
else {
let j = i + w.length;
while (j < len && code[j] === ' ') j++;
if (code[j] === '(') type = 'function';
}
tokens.push({ type, text: w });
i += w.length;
continue;
}
}
{
const m = code.slice(i).match(/^[+\-*/%=<>!&|^~:]+/);
if (m) {
tokens.push({ type: 'operator', text: m[0] });
i += m[0].length;
continue;
}
}
if ('(){}[],;.'.includes(code[i])) {
tokens.push({ type: 'punctuation', text: code[i] });
i++;
continue;
}
{
const m = code.slice(i).match(/^\s+/);
if (m) {
tokens.push({ type: 'plain', text: m[0] });
i += m[0].length;
} else {
tokens.push({ type: 'plain', text: code[i] });
i++;
}
}
}
return tokens.map(t => {
const esc = escapeHtml(t.text);
return t.type === 'plain' ? esc : `<span class="tok-${t.type}">${esc}</span>`;
}).join('');
}
document.querySelectorAll('pre code').forEach(block => {
block.innerHTML = highlight(block.textContent);
});
/* ==========================================================
LIGHTBOX
========================================================== */
class Lightbox {
constructor() {
this.images = [];
this.currentIndex = 0;
this.isOpen = false;
this._build();
this._bindImages();
this._bindKeys();
this._bindSwipe();
}
_build() {
this.el = document.createElement('div');
this.el.className = 'lightbox-overlay';
this.el.setAttribute('role', 'dialog');
this.el.setAttribute('aria-modal', 'true');
this.el.setAttribute('aria-label', 'Image viewer');
this.el.innerHTML = `
<button class="lightbox-btn lightbox-close" aria-label="Close">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
<line x1="18" y1="6" x2="6" y2="18"/>
<line x1="6" y1="6" x2="18" y2="18"/>
</svg>
</button>
<button class="lightbox-btn lightbox-arrow lightbox-prev" aria-label="Previous image">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="15 18 9 12 15 6"/>
</svg>
</button>
<button class="lightbox-btn lightbox-arrow lightbox-next" aria-label="Next image">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round">
<polyline points="9 6 15 12 9 18"/>
</svg>
</button>
<img class="lightbox-img" src="" alt="">
<div class="lightbox-counter"></div>
`;
document.body.appendChild(this.el);
this.imgEl = this.el.querySelector('.lightbox-img');
this.counterEl = this.el.querySelector('.lightbox-counter');
this.prevBtn = this.el.querySelector('.lightbox-prev');
this.nextBtn = this.el.querySelector('.lightbox-next');
this.closeBtn = this.el.querySelector('.lightbox-close');
this.closeBtn.addEventListener('click', () => this.close());
this.prevBtn.addEventListener('click', (e) => { e.stopPropagation(); this.prev(); });
this.nextBtn.addEventListener('click', (e) => { e.stopPropagation(); this.next(); });
this.el.addEventListener('click', (e) => {
if (e.target === this.el) this.close();
});
}
_bindImages() {
this.images = Array.from(document.querySelectorAll('.article img'));
this.images.forEach((img, idx) => {
img.addEventListener('click', () => this.open(idx));
});
}
_bindKeys() {
document.addEventListener('keydown', (e) => {
if (!this.isOpen) return;
if (e.key === 'Escape') this.close();
if (e.key === 'ArrowLeft') this.prev();
if (e.key === 'ArrowRight') this.next();
});
}
_bindSwipe() {
let startX = 0;
this.el.addEventListener('touchstart', (e) => {
startX = e.changedTouches[0].clientX;
}, { passive: true });
this.el.addEventListener('touchend', (e) => {
const dx = startX - e.changedTouches[0].clientX;
if (Math.abs(dx) > 60) {
dx > 0 ? this.next() : this.prev();
}
}, { passive: true });
}
open(idx) {
this.currentIndex = idx;
this.isOpen = true;
this._update();
requestAnimationFrame(() => {
this.el.classList.add('active');
});
document.body.style.overflow = 'hidden';
this.closeBtn.focus();
}
close() {
this.isOpen = false;
this.el.classList.remove('active');
document.body.style.overflow = '';
this.images[this.currentIndex]?.focus();
}
prev() {
this.currentIndex = (this.currentIndex - 1 + this.images.length) % this.images.length;
this._update();
}
next() {
this.currentIndex = (this.currentIndex + 1) % this.images.length;
this._update();
}
_update() {
const srcImg = this.images[this.currentIndex];
this.imgEl.style.opacity = '0';
this.imgEl.style.transform = 'scale(0.96)';
setTimeout(() => {
this.imgEl.src = srcImg.src;
this.imgEl.alt = srcImg.alt;
this.imgEl.removeAttribute('loading');
this.imgEl.style.opacity = '1';
this.imgEl.style.transform = 'scale(1)';
}, 120);
const total = this.images.length;
if (total > 1) {
this.counterEl.textContent = `${this.currentIndex + 1} / ${total}`;
this.prevBtn.style.display = '';
this.nextBtn.style.display = '';
} else {
this.counterEl.textContent = '';
this.prevBtn.style.display = 'none';
this.nextBtn.style.display = 'none';
}
}
}
new Lightbox();
</script>
</body>
</html> |