bsc

Comprehensive codebase and coursework for the 4-year B.Sc. Computer Science Honours degree (WBSU)

git clone https://github.com/notamitgamer/bsc.git
· rebuilt hourlyOpen on GitHub
root / docs / .vitepress / config.mts

config.mts (6379B)


      1 import { defineConfig } from 'vitepress'
      2 import { withSidebar } from 'vitepress-sidebar'
      3 
      4 const vitePressConfig = {
      5   title: 'BSc Code Index',
      6   description: 'C programming assignments, indexed and documented.',
      7   lang: 'en-US',
      8   cleanUrls: true,
      9   lastUpdated: true,
     10 
     11   head: [
     12     // Logo & Fonts
     13     ['link', { rel: 'icon', type: 'image/svg+xml', href: '/favicon.svg' }],
     14 
     15     // PWA manifest + theme color (fixes the white splash flash on install/launch)
     16     ['link', { rel: 'manifest', href: '/manifest.webmanifest' }],
     17     ['meta', { name: 'theme-color', content: '#0d1117' }],
     18     ['link', { rel: 'apple-touch-icon', href: '/logo_192.png' }],
     19     ['meta', { name: 'apple-mobile-web-app-capable', content: 'yes' }],
     20     ['meta', { name: 'apple-mobile-web-app-status-bar-style', content: 'black-translucent' }],
     21     ['link', { rel: 'preconnect', href: 'https://fonts.googleapis.com' }],
     22     ['link', { rel: 'preconnect', href: 'https://fonts.gstatic.com', crossorigin: '' }],
     23     ['link', { rel: 'stylesheet', href: 'https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:ital,wght@0,400;0,500;0,600;0,700;1,400&display=swap' }],
     24 
     25     // Algolia Search warm-up
     26     ['link', { rel: 'preconnect', href: 'https://5PYB0FB4RG-dsn.algolia.net', crossorigin: '' }],
     27     ['link', { rel: 'preconnect', href: 'https://5PYB0FB4RG.algolia.net', crossorigin: '' }],
     28     
     29     // SEO & Social Meta Tags
     30     ['meta', { name: 'algolia-site-verification', content: 'D732FF69A9237B42' }],
     31     ['meta', { property: 'og:type', content: 'website' }],
     32     ['meta', { property: 'og:site_name', content: 'BSc Code Index' }],
     33     ['meta', { property: 'og:title', content: 'BSc Code Index' }],
     34     ['meta', { property: 'og:description', content: 'C programming assignments, indexed and documented.' }],
     35     ['meta', { property: 'og:url', content: 'https://code.amit.is-a.dev' }],
     36     ['meta', { name: 'twitter:card', content: 'summary' }],
     37     ['meta', { name: 'twitter:title', content: 'BSc Code Index' }],
     38     ['meta', { name: 'twitter:description', content: 'C programming assignments, indexed and documented.' }],
     39   ] as [string, any][],
     40 
     41   sitemap: {
     42     hostname: 'https://code.amit.is-a.dev',
     43   },
     44 
     45   transformPageData(pageData) {
     46     if (pageData.title) {
     47       pageData.title = pageData.title
     48         .replace(/[\p{Emoji_Presentation}\p{Extended_Pictographic}]/gu, '') 
     49         .replace(/<[^>]*>?/gm, '') 
     50         .trim();
     51     }
     52   },
     53 
     54   vite: {
     55   server: {
     56     allowedHosts: true as true,
     57     host: true,
     58   }
     59 } as any,
     60 
     61   themeConfig: {
     62     logo: {
     63       light: '/logo_light.svg',
     64       dark: '/logo_dark.svg',
     65   },
     66 
     67     nav: [
     68       { text: 'Terms', link: '/terms'},
     69       { text: 'Quick Start', link: '/quickstart'},
     70       { 
     71         text: 'Semesters', 
     72         items: [
     73           { text: 'Semester 1 (Archived)', link: '/semester_1/' },
     74           { text: 'Semester 2 (Active)', link: '/semester_2/' },
     75           { text: 'Semester 3', link: '/semester_3/' },
     76           { text: 'Semester 4', link: '/semester_4/' },
     77           { text: 'Semester 5', link: '/semester_5/' },
     78           { text: 'Semester 6', link: '/semester_6/' },
     79           { text: 'Semester 7', link: '/semester_7/' },
     80           { text: 'Semester 8', link: '/semester_8/' },
     81         ]
     82       },
     83       { text: 'Tags', link: '/tags' },
     84       { text: 'License', link: 'https://github.com/notamitgamer/bsc/blob/main/LICENSE'},
     85       { text: 'Changelog', link: '/changelog' },
     86     ],
     87 
     88     socialLinks: [
     89       { icon: 'github', link: 'https://github.com/notamitgamer/bsc' },
     90     ],
     91 
     92     search: {
     93       provider: 'algolia',
     94       options: {
     95         appId: '5PYB0FB4RG',
     96         apiKey: '51d9424f9480f1a3efd0d07f023c4a12',
     97         indexName: 'bsc code index',
     98         askAi: {
     99           assistantId: '52566362-9715-4ba2-bfa6-9b2b1fae4e10',
    100           mode: 'hybrid',
    101           sidePanel: true,
    102           appId: '5PYB0FB4RG',
    103           apiKey: '51d9424f9480f1a3efd0d07f023c4a12',
    104           indexName: 'bsc code index',
    105           agentStudio: true,
    106         },
    107         placeholder: 'Search programs...',
    108         insights: true,
    109         /* searchParameters: {
    110           restrictSearchableAttributes: [
    111             'hierarchy.lvl0',
    112             'hierarchy.lvl1',
    113             'hierarchy.lvl2',
    114             'content' 
    115           ],
    116         }, */
    117         translations: {
    118           button: {
    119             buttonText: 'Search programs...',
    120             buttonAriaLabel: 'Search programs',
    121           },
    122           modal: {
    123             noResultsScreen: {
    124               noResultsText: 'No programs found for',
    125             }
    126           }
    127         }
    128       }
    129     },
    130 
    131     editLink: {
    132       pattern: (ctx) => {
    133         if (ctx.frontmatter.source) {
    134           return `https://github.com/notamitgamer/bsc/edit/main/${ctx.frontmatter.source}`
    135         }
    136         return `https://github.com/notamitgamer/bsc/edit/main/docs/${ctx.filePath}`
    137       },
    138       text: 'Edit this page on GitHub',
    139     },
    140 
    141     lastUpdated: {
    142       text: 'Last updated',
    143       formatOptions: {
    144         dateStyle: 'medium',
    145         timeStyle: 'short',
    146       }
    147     },
    148 
    149     outline: {
    150       level: [2, 3],
    151       label: 'On this page',
    152     },
    153 
    154     externalLinkIcon: true,
    155 
    156     docFooter: {
    157       prev: 'Previous',
    158       next: 'Next',
    159     },
    160 
    161     notFound: {
    162       title: 'Looks like you\'re lost.',
    163       quote: 'The page you are looking for might have moved, changed its name, or vanished into thin air.',
    164       linkLabel: 'No worries, let\'s get you back.',
    165       linkText: 'Take me home',
    166       code: '404'
    167     },
    168 
    169     returnToTopLabel: 'Back to top',
    170     darkModeSwitchLabel: 'Theme',
    171     sidebarMenuLabel: 'Menu',
    172   },
    173 
    174   markdown: {
    175     lineNumbers: true,
    176     math: true, 
    177     image: {
    178       lazyLoading: true 
    179     },
    180     theme: {
    181       light: 'github-light',
    182       dark: 'github-dark' 
    183     } as any
    184   },
    185 }
    186 
    187 const sidebarConfig = {
    188   documentRootPath: 'docs',
    189   collapsed: true,
    190   collapseDepth: 1,
    191   useTitleFromFrontmatter: true,
    192   useTitleFromFileHeading: true,
    193   useFolderTitleFromIndexFile: true,
    194   useFolderLinkFromIndexFile: true,
    195   excludeFiles: ['tags.md'],
    196   excludeFolders: ['stylesheets', 'overrides', 'assets', '.vitepress'],
    197   sortMenusByName: true,
    198   sortMenusOrderNumerically: true,
    199   underscoreToSpace: true,
    200   capitalizeFirst: true,
    201 }
    202 
    203 export default defineConfig(withSidebar(vitePressConfig, sidebarConfig))