๐ LARC Wiki Explorer
A beautiful, interactive documentation browser built with LARC components. Browse all markdown, HTML, and PDF files in the repository with an intuitive tree navigation and rich content viewer.
Features
- ๐ณ Tree Navigation: Hierarchical file browser with expandable folders using
pan-treecomponent - ๐ Markdown Rendering: Beautiful rendering of markdown documents using
pan-markdown-renderercomponent - ๐ Quick Search: Filter files by name in real-time
- ๐ Multiple Formats: View .md, .html, and .pdf files
- ๐ Statistics: See folder count, file count, and total size at a glance
Quick Start
1. Generate the File Tree
First, generate the JSON file tree of all documentation files:
cd /Users/cdr/Projects/larc-repos/docs
node generate-file-tree.mjs
This will create file-tree.json containing all markdown, HTML, and PDF files in the docs directory.
2. Open the Wiki Explorer
Open wiki-explorer.html in your browser:
open wiki-explorer.html
Or serve it with a local HTTP server:
python3 -m http.server 8000
# Then visit http://localhost:8000/wiki-explorer.html
Usage
File Types
- ๐ Markdown (.md): Rendered with syntax highlighting and proper formatting
- ๐ HTML (.html): Displayed in an embedded iframe
- ๐ PDF (.pdf): Embedded PDF viewer
- ๐ Other: Raw text display
Components Used
This demo showcases the following LARC components:
: Collapsible tree component with navigation: Markdown to HTML renderer with syntax highlighting: Message bus for component communicationPanClient: JavaScript client for publishing/subscribing to messages
Architecture
The wiki explorer uses LARC's event-driven architecture:
Customization
Changing Scanned Extensions
Edit generate-file-tree.mjs:
const EXTENSIONS = ['.md', '.html', '.pdf', '.txt']; // Add more extensions
Styling
All styles are in wiki-explorer.html. Key CSS variables:
- Tree icons can be customized via
icon-open,icon-closed,icon-leafattributes - Colors can be adjusted in the header gradient and tree selection styles
Search Behavior
The search filter works on file names. To search content, modify the searchInput event handler to include content search.
File Tree Structure
The generated file-tree.json has this structure:
{
"metadata": {
"generated": "ISO date",
"root": "/path/to/docs",
"extensions": [".md", ".html", ".pdf"],
"stats": {
"folders": 43,
"files": 287,
"totalSize": 18135302,
"totalSizeFormatted": "17.3 MB"
}
},
"tree": [
{
"id": "unique-id",
"name": "File Name",
"type": "file" | "folder",
"path": "relative/path/to/file.md",
"extension": ".md",
"size": 1234,
"modified": "ISO date",
"children": []
}
]
}
Regenerating the File Tree
Run the generator script whenever you add/remove/move files:
node generate-file-tree.mjs
The script will:
- Scan all subdirectories (excluding
node_modules,.git, etc.) - Find all files with specified extensions
- Generate a hierarchical tree structure
- Output statistics
- Save to
file-tree.json
Development
To extend the wiki explorer:
loadFile() functionBrowser Compatibility
Works in all modern browsers that support:
- ES6 Modules
- Web Components (Custom Elements)
- Shadow DOM
- Fetch API
License
Part of the LARC project.