fix: Fix docs-viewer TOC, cache busting, and documentLoaded event
- Fix TOC field name mismatch: API returns title/slug but renderTOC read text/id, causing empty bullet points - Dispatch documentLoaded event after async content loads so sidebar TOC rebuilds with actual headings - Update cache-bust version strings to force fresh JS/CSS Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
1ed8ced02c
commit
962edaa34b
2 changed files with 16 additions and 10 deletions
|
|
@ -4,8 +4,8 @@
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>Documentation - Tractatus Framework</title>
|
<title>Documentation - Tractatus Framework</title>
|
||||||
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.2.1770452675442">
|
<link rel="stylesheet" href="/css/tailwind.css?v=0.1.3.1739079900">
|
||||||
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.2.1770452675442">
|
<link rel="stylesheet" href="/css/tractatus-theme.min.css?v=0.1.3.1739079900">
|
||||||
<style>
|
<style>
|
||||||
/* Prose styling for document content - uses plain CSS (not @apply, which is build-time only) */
|
/* Prose styling for document content - uses plain CSS (not @apply, which is build-time only) */
|
||||||
.prose h1 { font-size: 1.875rem; font-weight: 700; margin-top: 2rem; margin-bottom: 1rem; color: #111827; line-height: 1.2; }
|
.prose h1 { font-size: 1.875rem; font-weight: 700; margin-top: 2rem; margin-bottom: 1rem; color: #111827; line-height: 1.2; }
|
||||||
|
|
@ -77,12 +77,12 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Scripts -->
|
<!-- Scripts -->
|
||||||
<script src="/js/utils/api.js?v=0.1.2.1770452675442"></script>
|
<script src="/js/utils/api.js?v=0.1.3.1739079900"></script>
|
||||||
<script src="/js/utils/router.js?v=0.1.2.1770452675442"></script>
|
<script src="/js/utils/router.js?v=0.1.3.1739079900"></script>
|
||||||
<script src="/js/components/document-viewer.js?v=0.1.2.1770452675442"></script>
|
<script src="/js/components/document-viewer.js?v=0.1.3.1739079900"></script>
|
||||||
<script src="/js/components/code-copy-button.js?v=0.1.2.1770452675442"></script>
|
<script src="/js/components/code-copy-button.js?v=0.1.3.1739079900"></script>
|
||||||
<script src="/js/components/toc.js?v=0.1.2.1770452675442"></script>
|
<script src="/js/components/toc.js?v=0.1.3.1739079900"></script>
|
||||||
<script src="/js/docs-viewer-app.js?v=0.1.2.1770452675442"></script>
|
<script src="/js/docs-viewer-app.js?v=0.1.3.1739079900"></script>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,9 @@ class DocumentViewer {
|
||||||
|
|
||||||
// Add smooth scroll to TOC links
|
// Add smooth scroll to TOC links
|
||||||
this.initializeTOCLinks();
|
this.initializeTOCLinks();
|
||||||
|
|
||||||
|
// Notify TOC component that content has loaded
|
||||||
|
document.dispatchEvent(new Event('documentLoaded'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -110,11 +113,14 @@ class DocumentViewer {
|
||||||
item.level === 3 ? 'ml-8' :
|
item.level === 3 ? 'ml-8' :
|
||||||
item.level === 4 ? 'ml-12' :
|
item.level === 4 ? 'ml-12' :
|
||||||
'ml-16';
|
'ml-16';
|
||||||
|
// Handle both API formats: {text, id} and {title, slug}
|
||||||
|
const itemText = item.text || item.title || '';
|
||||||
|
const itemId = item.id || item.slug || '';
|
||||||
return `
|
return `
|
||||||
<li class="${marginClass}">
|
<li class="${marginClass}">
|
||||||
<a href="#${item.id}"
|
<a href="#${itemId}"
|
||||||
class="text-blue-600 hover:text-blue-700 hover:underline">
|
class="text-blue-600 hover:text-blue-700 hover:underline">
|
||||||
${this.escapeHtml(item.text)}
|
${this.escapeHtml(itemText)}
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
`;
|
`;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue