mirror of
https://github.com/litruv/Docs-Viewer.git
synced 2026-07-24 18:56:07 +10:00
Add configuration section for folder structure and update folder open state handling
This commit is contained in:
@@ -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.
|
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
|
## Available Documentation
|
||||||
|
|
||||||
- **[[DeepImpact]]** - A Blueprint Function Library for depth-based line traces in Unreal Engine
|
- **[[DeepImpact]]** - A Blueprint Function Library for depth-based line traces in Unreal Engine
|
||||||
|
|||||||
4
index.js
4
index.js
@@ -48,14 +48,14 @@ async function initializeMarked() {
|
|||||||
function createFileIndexItem(doc, container, level = 0) {
|
function createFileIndexItem(doc, container, level = 0) {
|
||||||
if (doc.type === 'folder') {
|
if (doc.type === 'folder') {
|
||||||
const folderDiv = document.createElement('div');
|
const folderDiv = document.createElement('div');
|
||||||
folderDiv.className = 'folder open';
|
folderDiv.className = 'folder' + (doc.defaultOpen !== false ? ' open' : '');
|
||||||
folderDiv.dataset.path = doc.title;
|
folderDiv.dataset.path = doc.title;
|
||||||
folderDiv.style.paddingLeft = `${level * 0.8}rem`;
|
folderDiv.style.paddingLeft = `${level * 0.8}rem`;
|
||||||
|
|
||||||
const folderHeader = document.createElement('div');
|
const folderHeader = document.createElement('div');
|
||||||
folderHeader.className = 'folder-header';
|
folderHeader.className = 'folder-header';
|
||||||
folderHeader.innerHTML = `
|
folderHeader.innerHTML = `
|
||||||
<i class="fas fa-folder-open folder-icon"></i>
|
<i class="fas fa-folder${doc.defaultOpen !== false ? '-open' : ''} folder-icon"></i>
|
||||||
<span>${doc.title}</span>
|
<span>${doc.title}</span>
|
||||||
`;
|
`;
|
||||||
folderDiv.appendChild(folderHeader);
|
folderDiv.appendChild(folderHeader);
|
||||||
|
|||||||
Reference in New Issue
Block a user