Skip to content

Commit 2609d8c

Browse files
committed
custom css
1 parent 4110d96 commit 2609d8c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -756,6 +756,20 @@ class Documentation {
756756
this.setupKeyboardShortcuts();
757757
}
758758

759+
/**
760+
* Loads a custom CSS file if specified in the index.json
761+
* @param {string} customCSSPath - Path to the custom CSS file relative to document root
762+
*/
763+
loadCustomCSS(customCSSPath) {
764+
if (!customCSSPath) return;
765+
766+
const link = document.createElement('link');
767+
link.rel = 'stylesheet';
768+
link.type = 'text/css';
769+
link.href = customCSSPath; // Path is relative to document root
770+
document.head.appendChild(link);
771+
}
772+
759773
setupEventListeners() {
760774
this.eventBus.on('navigation:requested', async ({ slug, hash }) => {
761775
slug = slug.replace(/^[?=]/, '');
@@ -864,6 +878,11 @@ class Documentation {
864878
this.indexData = data;
865879
window._indexData = data;
866880

881+
// Load custom CSS if provided in index.json
882+
if (data.customCSS) {
883+
this.loadCustomCSS(data.customCSS);
884+
}
885+
867886
this.searchService.buildSearchIndex(this.indexData.documents);
868887
this.domService.setupSearch(this.searchService);
869888

0 commit comments

Comments
 (0)