// Populate the sidebar
//
// This is a script, and not included directly in the page, to control the total size of the book.
// The TOC contains an entry for each page, so if each page includes a copy of the TOC,
// the total size of the page becomes O(n**2).
class MDBookSidebarScrollbox extends HTMLElement {
constructor() {
super();
}
connectedCallback() {
this.innerHTML = '
- Introduction
- Project Definition
- 1. What is KOGRAL?
- 2. Core Concepts
- 3. Why KOGRAL?
- 4. Design Philosophy
- Guides
- 5. Installation
- 6. Quick Start
- 7. Daily Workflows
- 8. Use Cases
- 9. Best Practices
- Architecture
- 10. System Overview
- 11. Graph Model
- 12. Config-Driven Design
- 13. Storage Architecture
- 14. Logseq Blocks Design
- 15. ADR-001: Nickel vs TOML for Configuration
- 16. ADR-002: FastEmbed via AI Providers
- 17. ADR-003: Hybrid Storage Strategy
- 18. ADR-004: Logseq Blocks Support
- 19. ADR-005: MCP Protocol for AI Integration
- Setup
- 20. Prerequisites
- 21. Installation Methods
- 22. Project Initialization
- 23. Environment Configuration
- 24. Verification
- Configuration
- 25. Configuration Overview
- 26. Nickel Schemas
- 27. Graph Settings
- 28. Inheritance
- 29. Examples
- Storage
- 30. Storage Backends
- 31. Filesystem Storage
- 32. SurrealDB Storage
- 33. In-Memory Storage
- 34. Sync Strategies
- AI & Embeddings
- 35. Embeddings Overview
- 36. Provider Configuration
- 37. FastEmbed Local
- 38. OpenAI Integration
- 39. Claude Integration
- 40. Ollama Integration
- 41. Semantic Search
- Templates
- 42. Template System
- 43. Document Templates
- 44. Export Templates
- 45. Customization
- CLI
- 46. CLI Overview
- 47. Commands Reference
- 48. Workflows
- 49. NuShell Scripts
- Apps & Connections
- 50. MCP Quick Guide
- 51. Claude Code Integration
- 52. Logseq Integration
- 53. Obsidian Compatibility
- 54. Git Workflows
- API Reference
- 55. MCP Protocol
- 56. Tools Reference
- 57. Resources
- 58. Rust API
- Contributing
- 59. Development Setup
- 60. Code Standards
- 61. Testing
';
// Set the current, active page, and reveal it if it's hidden
let current_page = document.location.href.toString().split("#")[0].split("?")[0];
if (current_page.endsWith("/")) {
current_page += "index.html";
}
var links = Array.prototype.slice.call(this.querySelectorAll("a"));
var l = links.length;
for (var i = 0; i < l; ++i) {
var link = links[i];
var href = link.getAttribute("href");
if (href && !href.startsWith("#") && !/^(?:[a-z+]+:)?\/\//.test(href)) {
link.href = path_to_root + href;
}
// The "index" page is supposed to alias the first chapter in the book.
if (link.href === current_page || (i === 0 && path_to_root === "" && current_page.endsWith("/index.html"))) {
link.classList.add("active");
var parent = link.parentElement;
if (parent && parent.classList.contains("chapter-item")) {
parent.classList.add("expanded");
}
while (parent) {
if (parent.tagName === "LI" && parent.previousElementSibling) {
if (parent.previousElementSibling.classList.contains("chapter-item")) {
parent.previousElementSibling.classList.add("expanded");
}
}
parent = parent.parentElement;
}
}
}
// Track and set sidebar scroll position
this.addEventListener('click', function(e) {
if (e.target.tagName === 'A') {
sessionStorage.setItem('sidebar-scroll', this.scrollTop);
}
}, { passive: true });
var sidebarScrollTop = sessionStorage.getItem('sidebar-scroll');
sessionStorage.removeItem('sidebar-scroll');
if (sidebarScrollTop) {
// preserve sidebar scroll position when navigating via links within sidebar
this.scrollTop = sidebarScrollTop;
} else {
// scroll sidebar to current active section when navigating via "next/previous chapter" buttons
var activeSection = document.querySelector('#sidebar .active');
if (activeSection) {
activeSection.scrollIntoView({ block: 'center' });
}
}
// Toggle buttons
var sidebarAnchorToggles = document.querySelectorAll('#sidebar a.toggle');
function toggleSection(ev) {
ev.currentTarget.parentElement.classList.toggle('expanded');
}
Array.from(sidebarAnchorToggles).forEach(function (el) {
el.addEventListener('click', toggleSection);
});
}
}
window.customElements.define("mdbook-sidebar-scrollbox", MDBookSidebarScrollbox);