- Replace broken @apply directives with plain CSS (Tailwind @apply is build-time only, was silently failing in browser <style> tags) - Add table, hr, and list-item spacing styles for research papers - Handle ?slug= query parameter in docs-viewer-app.js so blog post links to docs-viewer.html?slug=X load the correct document Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
// Initialize document viewer
|
|
const viewer = new DocumentViewer('document-viewer');
|
|
|
|
// Load navigation
|
|
async function loadNavigation() {
|
|
try {
|
|
const response = await API.Documents.list({ limit: 50 });
|
|
const nav = document.getElementById('doc-navigation');
|
|
|
|
if (response.success && response.documents) {
|
|
nav.innerHTML = response.documents.map(doc => `
|
|
<a href="/docs/${doc.slug}"
|
|
data-route="/docs/${doc.slug}"
|
|
class="block px-3 py-2 text-sm text-gray-700 hover:bg-gray-100 rounded-md">
|
|
${doc.title}
|
|
</a>
|
|
`).join('');
|
|
}
|
|
} catch (error) {
|
|
console.error('Failed to load navigation:', error);
|
|
}
|
|
}
|
|
|
|
// Setup routing
|
|
router
|
|
.on('/docs-viewer.html', async () => {
|
|
// Check for ?slug= query parameter first
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const slug = urlParams.get('slug');
|
|
await viewer.render(slug || 'introduction-to-the-tractatus-framework');
|
|
})
|
|
.on('/docs/:slug', async (params) => {
|
|
await viewer.render(params.slug);
|
|
});
|
|
|
|
// Initialize
|
|
loadNavigation();
|