diff --git a/index.html b/index.html index 79e7fa1f..c07df444 100644 --- a/index.html +++ b/index.html @@ -236,53 +236,18 @@ }, 100); }); }, - // Render .pine files as fixed-font code blocks inside docsify + // Render .pine files as syntax-highlighted code blocks with their own URL function(hook, vm) { - hook.doneEach(function() { - var content = document.querySelector('.markdown-section'); - if (!content) return; - content.querySelectorAll('a').forEach(function(a) { - var rawHref = a.getAttribute('href'); - if (!rawHref || !rawHref.endsWith('.pine')) return; - a.addEventListener('click', function(e) { - e.preventDefault(); - e.stopPropagation(); - // Extract the .pine path from the hash link or raw href - var pinePath = rawHref; - // If docsify converted it to a hash link: #/lib/.../file.pine - var fullHref = a.href || ''; - var hashIdx = fullHref.indexOf('#/'); - if (hashIdx !== -1) { - pinePath = fullHref.substring(hashIdx + 2); - } else if (!pinePath.startsWith('/') && !pinePath.startsWith('http')) { - // Relative link — resolve against current route's directory - var routeFile = (vm.route && vm.route.file) || ''; - var routeDir = routeFile.replace(/[^/]*$/, ''); - pinePath = routeDir + pinePath; - } - // Fetch from server root - var fetchUrl = pinePath.startsWith('/') ? pinePath : '/' + pinePath; - // For relative server (non-root), use document.baseURI - var absUrl = new URL(pinePath, document.baseURI).href; - fetch(absUrl).then(function(r) { - if (!r.ok) throw new Error(r.status + ' ' + r.statusText); - return r.text(); - }).then(function(text) { - // Verify we got pine content, not HTML fallback - if (text.trimStart().startsWith('Error
Could not load ' + pinePath + ': ' + err.message + '