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
commit 5e9d0193543750c00f602b69db05eff0e8ad57fe
parent 204c94be8a3f25726b422e874aa97d1d132795e2
Author: bot-for-notamitgamer <bot-for-notamitgamer@users.noreply.github.com>
Date:   Sat, 26 Sep 2026 12:31:54 +0000

Show footer on homepage, branch edit-link for generated vs authored pages

- Homepage uses 'layout: home' frontmatter, and VitePress's built-in
  home layout doesn't render the 'doc-before'/'doc-after' slots at
  all — those only exist in the 'doc' layout. Hooked
  'home-features-after' (the slot home layout actually exposes) so
  the footer shows there too. Added a max-width + centering to
  DocFooterExtra so it looks the same width on both the narrower doc
  column and the wider home container.
- 'Suggest an edit' now branches on whether the page was built by
  utils/bsc_md/pipeline.py. Both generator functions (build_algo_md
  and build_md in builders.py) stamp 'source' into frontmatter for
  every page they produce, so that field is already a reliable
  signal. Generated pages now link to utils/bsc_md on GitHub with
  copy explaining why ('View the generator scripts'), since editing
  the rendered .md directly wouldn't survive the next build.
  Hand-authored pages in /docs (no 'source' frontmatter) are
  unchanged — straight to that file's GitHub edit UI.

Note: this only touches the secondary 'Suggest an edit' button in the
footer. VitePress's native editLink in the top toolbar already links
correctly to the raw source file (.cpp/.c/etc.) for generated pages
and is untouched by this change.

Diffstat:
Mdocs/.vitepress/theme/components/DocFooterExtra.vue | 27+++++++++++++++++++++++----
Mdocs/.vitepress/theme/index.ts | 4++++
2 files changed, 27 insertions(+), 4 deletions(-)

diff --git a/docs/.vitepress/theme/components/DocFooterExtra.vue b/docs/.vitepress/theme/components/DocFooterExtra.vue @@ -48,7 +48,12 @@ <div class="col contribute-col"> <p class="col-title">Help improve this page</p> <p class="col-text"> - Spotted a mistake or something unclear? All content is open source. + <template v-if="isGenerated"> + This page is generated from source by a build script — editing it directly wouldn't stick. Spotted a bug in how it's built? + </template> + <template v-else> + Spotted a mistake or something unclear? All content is open source. + </template> </p> <a :href="editUrl" @@ -56,7 +61,7 @@ rel="noopener noreferrer" class="contribute-btn" > - Suggest an edit + {{ isGenerated ? 'View the generator scripts' : 'Suggest an edit' }} </a> </div> @@ -119,9 +124,16 @@ function scrollTop() { window.scrollTo({ top: 0, behavior: 'smooth' }) } +const isGenerated = computed(() => Boolean(frontmatter.value.source)) + +// Generated pages (algorithm write-ups and per-program pages) are built by +// utils/bsc_md/pipeline.py from source files — the rendered .md is an +// artifact, not something to hand-edit, so send people to the generator +// instead of the throwaway output. Pages actually authored in /docs (no +// 'source' frontmatter) go straight to their own .md on GitHub's edit UI. const editUrl = computed(() => - frontmatter.value.source - ? `https://github.com/notamitgamer/bsc/edit/main/${frontmatter.value.source}` + isGenerated.value + ? 'https://github.com/notamitgamer/bsc/tree/main/utils/bsc_md' : `https://github.com/notamitgamer/bsc/edit/main/docs/${page.value.filePath}` ) </script> @@ -133,6 +145,13 @@ const editUrl = computed(() => padding-top: 0; font-family: var(--vp-font-family-base); clear: both; + /* Keeps the same visual width whether this renders inside the narrow + doc content column or the wider home-layout container. */ + max-width: 688px; + margin-left: auto; + margin-right: auto; + padding-left: 24px; + padding-right: 24px; } .doc-footer-extra button, diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts @@ -32,6 +32,10 @@ export default { 'doc-after': () => h(Fragment, [ h(DocFooterExtra) ]), + // The homepage uses `layout: home`, which does not render 'doc-after' + // at all — that slot only exists in VitePress's 'doc' layout. Hook the + // home layout's own slot so the footer shows there too. + 'home-features-after': () => h(DocFooterExtra), 'sidebar-nav-after': () => h(SidebarTags), 'nav-bar-content-after': () => h(SponsorButton) })