bsc

Comprehensive codebase and cou...
Log | Files | Refs | README | LICENSE

commit f44ed1cb105a82562d8074eedb3d1592c36ccb38
parent c86e130df758330f45e3a4fb37dfa4672a1d3803
Author: Amit Dutta <amitdutta4255@gmail.com>
Date:   Tue, 30 Jun 2026 12:50:44 +0530

more practical code viewer

Diffstat:
Mdocs/.vitepress/config.mts | 16+++++++++++-----
Mmd.py | 8++++----
2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/docs/.vitepress/config.mts b/docs/.vitepress/config.mts @@ -25,6 +25,7 @@ const vitePressConfig = { ['meta', { name: 'twitter:card', content: 'summary' }], ['meta', { name: 'twitter:title', content: 'BSc Code Index' }], ['meta', { name: 'twitter:description', content: 'C programming assignments, indexed and documented.' }], + ['script', {}, `if (typeof window !== 'undefined') localStorage.setItem('vitepress:local-search-detailed-list', 'true');`] ] as [string, any][], sitemap: { @@ -82,6 +83,7 @@ const vitePressConfig = { search: { provider: 'local', options: { + detailedView: true, locales: { root: { translations: { @@ -111,13 +113,17 @@ const vitePressConfig = { }, }, }, - // Search through description (problem statement) and title _render(src: string, env: any, md: any) { - const html = md.render(src, env) - if (env.frontmatter?.description) { - return env.frontmatter.description + ' ' + html + // Regex to capture from "### Problem Statement" to the closing ":::" + const match = src.match(/(### Problem Statement[\s\S]*?:::\s*tip Statement[\s\S]*?:::)/); + + if (match) { + // Render and index ONLY the extracted problem statement block + return md.render(match[1], env); } - return html + + // If no problem statement is found, return nothing so the code isn't indexed + return ''; } } }, diff --git a/md.py b/md.py @@ -327,7 +327,7 @@ def build_md(filename, lang_label, fence_lang, author, date, repo, license_str, "", "### Problem Statement", "", - "::: tip Problem Statement", + f"::: tip {filename}", esc_html(problem_statement), ":::", "", @@ -336,6 +336,9 @@ def build_md(filename, lang_label, fence_lang, author, date, repo, license_str, body += [ "## Source Code", "", + f"```{fence_lang} [{filename}]", + code, + "```", # Action links — minimal, right-aligned feel via HTML '<div style="display:flex;gap:12px;margin-bottom:12px;">', f' <a href="{github_url}" target="_blank" rel="noopener noreferrer"' @@ -373,9 +376,6 @@ def build_md(filename, lang_label, fence_lang, author, date, repo, license_str, "::: info Printing the code", "To print this file, open it on GitHub and click **Raw** before printing, or use the **Download Raw** button above and print directly from that page.", ":::", - f"```{fence_lang} [{filename}]", - code, - "```", "", ]
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror