mirror of
https://github.com/litruv/Docs-Viewer.git
synced 2026-07-25 03:06:07 +10:00
Compare commits
4 Commits
8fbfd2ae77
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 407ee6c0d3 | |||
| d9a6943570 | |||
| 341e4e48ff | |||
| 83c7566e6c |
68
README.md
68
README.md
@@ -4,14 +4,29 @@ A modern, accessible documentation viewer for Markdown files with live search, n
|
|||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- 🔍 Live search with keyboard shortcuts (Alt+S)
|
- 🔍 **Live search** with keyboard shortcuts (Alt+S) and result caching
|
||||||
- 📱 Mobile-friendly responsive design
|
- 📱 **Mobile-friendly** responsive design with focus trap
|
||||||
- 🎯 Keyboard navigation support
|
- 🎯 **Keyboard navigation** support (arrow keys, Enter, Escape)
|
||||||
- 📑 Auto-generated document outline
|
- 📑 **Auto-generated document outline** with collapsible headers
|
||||||
- 🔗 Wiki-style internal linking
|
- 🔗 **Wiki-style internal linking** with `[[Page Title]]` syntax
|
||||||
- 🖨️ Print-friendly styling
|
- 🖨️ **Print-friendly** styling
|
||||||
- ♿ ARIA-compliant accessibility
|
- ♿ **ARIA-compliant accessibility** (aria-current, role attributes, focus management)
|
||||||
- 🌙 Dark theme
|
- 🌙 **Dark theme** with CSS custom properties
|
||||||
|
- ⚡ **Performance optimized** with document caching and lazy loading
|
||||||
|
- 📊 **Loading indicators** with animated progress bars
|
||||||
|
|
||||||
|
|
||||||
|
## Screenshots
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img alt="Home" title="Home Page" src="https://github.com/user-attachments/assets/eb353607-7ce2-47fd-be87-479d9bbdac5c" height="300" />
|
||||||
|
<img alt="Mobile UI" title="Mobile View" src="https://github.com/user-attachments/assets/b6157ec9-519a-47b6-b487-d5447f599027" height="300" />
|
||||||
|
<br/>
|
||||||
|
<img alt="Search" title="Live Search" src="https://github.com/user-attachments/assets/4ae9b7f7-2d99-4668-b6f5-5bd52c135e26" height="300" />
|
||||||
|
<img alt="Outline" title="Document Outline Sidebar" src="https://github.com/user-attachments/assets/e2d58aa1-e297-4b7e-bec1-d3be5f69f45d" height="300" />
|
||||||
|
<img alt="Print" title="Print-Friendly View" src="https://github.com/user-attachments/assets/a840be73-ca93-46c6-9fbe-5d498c2c3525" height="300" />
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
@@ -124,13 +139,30 @@ To use the plugin:
|
|||||||
|
|
||||||
```
|
```
|
||||||
.
|
.
|
||||||
├── docs/ # Documentation files
|
├── docs/ # Documentation files
|
||||||
├── build-docs.js # Documentation builder
|
├── js/ # Application modules
|
||||||
├── index.html # Main viewer
|
│ ├── EventBus.js # Pub-sub event system
|
||||||
├── index.js # Application logic
|
│ ├── IndexService.js # Document index management
|
||||||
└── styles.css # Styling
|
│ ├── SearchService.js # Search with caching
|
||||||
|
│ ├── DOMService.js # DOM manipulation & accessibility
|
||||||
|
│ ├── DocumentService.js # Markdown loading & caching
|
||||||
|
│ ├── NavigationService.js # Browser history handling
|
||||||
|
│ └── Documentation.js # Main orchestrator
|
||||||
|
├── build-docs.js # Documentation builder
|
||||||
|
├── index.html # Main viewer
|
||||||
|
└── styles.css # Styling
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
|
||||||
|
The application uses a modular ES6 architecture with:
|
||||||
|
|
||||||
|
- **EventBus**: Pub-sub pattern for decoupled communication between services
|
||||||
|
- **Services**: Single-responsibility modules for search, DOM, documents, and navigation
|
||||||
|
- **Caching**: LRU caches for search results (50 entries) and documents (20 entries)
|
||||||
|
- **Lazy Loading**: Images use `loading="lazy"` for improved performance
|
||||||
|
|
||||||
|
|
||||||
### Building
|
### Building
|
||||||
|
|
||||||
The build process:
|
The build process:
|
||||||
@@ -171,10 +203,10 @@ For improved SEO and social sharing, you can use a Cloudflare Worker to dynamica
|
|||||||
|
|
||||||
### index.json
|
### index.json
|
||||||
|
|
||||||
|
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"defaultPage": "home",
|
"defaultPage": "home",
|
||||||
|
"showDocsLink": true,
|
||||||
"metadata": {
|
"metadata": {
|
||||||
"title": "Site Title",
|
"title": "Site Title",
|
||||||
"description": "Site description",
|
"description": "Site description",
|
||||||
@@ -194,6 +226,8 @@ For improved SEO and social sharing, you can use a Cloudflare Worker to dynamica
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
The `showDocsLink` option controls whether a "Docs" link is shown in the UI navigation. Set to `false` to hide it.
|
||||||
|
|
||||||
The build process generates the documents part for `index.json`
|
The build process generates the documents part for `index.json`
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|
||||||
@@ -201,6 +235,12 @@ The build process generates the documents part for `index.json`
|
|||||||
2. Create a feature branch
|
2. Create a feature branch
|
||||||
3. Submit a pull request
|
3. Submit a pull request
|
||||||
|
|
||||||
|
## Dependencies
|
||||||
|
|
||||||
|
- [marked.js](https://marked.js.org/) - Markdown parsing
|
||||||
|
- [highlight.js](https://highlightjs.org/) - Syntax highlighting
|
||||||
|
- [Font Awesome](https://fontawesome.com/) - Icons
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
MIT License - see LICENSE file for details.
|
MIT License - see LICENSE file for details.
|
||||||
|
|||||||
@@ -1,3 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* Shows or hides the Docs link in the sidebar based on config.
|
||||||
|
* @param {boolean} show - Whether to show the Docs link.
|
||||||
|
*/
|
||||||
|
setShowDocsLink(show) {
|
||||||
|
const docsLink = document.querySelector('.github-link');
|
||||||
|
if (docsLink) {
|
||||||
|
docsLink.style.display = show ? '' : 'none';
|
||||||
|
}
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Service responsible for DOM manipulation and UI rendering.
|
* Service responsible for DOM manipulation and UI rendering.
|
||||||
* @class DOMService
|
* @class DOMService
|
||||||
|
|||||||
@@ -172,6 +172,9 @@ class Documentation {
|
|||||||
this.loadCustomCSS(data.customCSS);
|
this.loadCustomCSS(data.customCSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Show/hide Docs link in sidebar
|
||||||
|
this.domService.setShowDocsLink(data.showDocsLink !== false);
|
||||||
|
|
||||||
this.searchService.buildSearchIndex(this.indexData.documents);
|
this.searchService.buildSearchIndex(this.indexData.documents);
|
||||||
this.domService.setupSearch(this.searchService);
|
this.domService.setupSearch(this.searchService);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user