From 41298c9fa60c302482b6fd275a79d0e83d3ec5e9 Mon Sep 17 00:00:00 2001 From: Max Litruv Boonzaayer Date: Tue, 4 Feb 2025 15:54:38 +1100 Subject: [PATCH] Add configuration section for folder structure and update folder open state handling --- docs/index.md | 5 +++++ index.js | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/index.md b/docs/index.md index f35ad9a..6ae956a 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,6 +2,11 @@ Welcome to the Documentation Here you'll find documentation for various tools and projects I've created. Select a document from the sidebar to get started. +## Configuration + +### Folder Structure +Folders in the sidebar can be configured to be open or closed by default using the `defaultOpen` flag in `index.json`: + ## Available Documentation - **[[DeepImpact]]** - A Blueprint Function Library for depth-based line traces in Unreal Engine diff --git a/index.js b/index.js index 5f442d6..820bfe8 100644 --- a/index.js +++ b/index.js @@ -48,14 +48,14 @@ async function initializeMarked() { function createFileIndexItem(doc, container, level = 0) { if (doc.type === 'folder') { const folderDiv = document.createElement('div'); - folderDiv.className = 'folder open'; + folderDiv.className = 'folder' + (doc.defaultOpen !== false ? ' open' : ''); folderDiv.dataset.path = doc.title; folderDiv.style.paddingLeft = `${level * 0.8}rem`; const folderHeader = document.createElement('div'); folderHeader.className = 'folder-header'; folderHeader.innerHTML = ` - + ${doc.title} `; folderDiv.appendChild(folderHeader);