|
368 | 368 | <a href="#contributing" class="nav-link" data-doc="contributing"><span class="icon">🤝</span> Contributing</a> |
369 | 369 | <a href="#security" class="nav-link" data-doc="security"><span class="icon">🔒</span> Security</a> |
370 | 370 | <a href="#coc" class="nav-link" data-doc="coc"><span class="icon">📜</span> Code of Conduct</a> |
| 371 | + <a href="#license" class="nav-link" data-doc="license"><span class="icon">⚖️</span> License</a> |
371 | 372 | </div> |
372 | 373 |
|
373 | 374 | <div class="nav-section"> |
|
402 | 403 | usage: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/docs/USAGE.md', |
403 | 404 | contributing: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/CONTRIBUTING.md', |
404 | 405 | security: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/SECURITY.md', |
405 | | - coc: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/CODE_OF_CONDUCT.md' |
| 406 | + coc: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/CODE_OF_CONDUCT.md', |
| 407 | + license: 'https://raw.githubusercontent.com/mithun50/CortexFlow/master/LICENSE' |
406 | 408 | }; |
407 | 409 |
|
408 | 410 | const contentEl = document.getElementById('content'); |
|
449 | 451 | gfm: true |
450 | 452 | }); |
451 | 453 |
|
| 454 | + // Map relative links to doc names |
| 455 | + const LINK_MAP = { |
| 456 | + 'LICENSE': 'license', |
| 457 | + 'CONTRIBUTING.md': 'contributing', |
| 458 | + 'SECURITY.md': 'security', |
| 459 | + 'CODE_OF_CONDUCT.md': 'coc', |
| 460 | + 'docs/API.md': 'api', |
| 461 | + 'docs/USAGE.md': 'usage' |
| 462 | + }; |
| 463 | + |
452 | 464 | async function loadDoc(docName) { |
453 | 465 | const url = DOCS[docName]; |
454 | 466 | if (!url) return; |
|
463 | 475 | Prism.highlightAll(); |
464 | 476 | window.scrollTo({ top: 0, behavior: 'smooth' }); |
465 | 477 |
|
| 478 | + // Intercept relative links in content |
| 479 | + contentEl.querySelectorAll('a').forEach(link => { |
| 480 | + const href = link.getAttribute('href'); |
| 481 | + if (href && !href.startsWith('http') && !href.startsWith('#')) { |
| 482 | + const docKey = LINK_MAP[href]; |
| 483 | + if (docKey) { |
| 484 | + link.addEventListener('click', (e) => { |
| 485 | + e.preventDefault(); |
| 486 | + loadDoc(docKey); |
| 487 | + history.pushState(null, '', `#${docKey}`); |
| 488 | + }); |
| 489 | + } |
| 490 | + } |
| 491 | + }); |
| 492 | + |
466 | 493 | // Close mobile menu |
467 | 494 | sidebar.classList.remove('active'); |
468 | 495 | overlay.classList.remove('active'); |
|
0 commit comments