mirror of
https://github.com/github/awesome-copilot.git
synced 2026-07-17 03:13:25 +00:00
chore: publish from main
This commit is contained in:
@@ -1,8 +1,22 @@
|
||||
import sitemap from "@astrojs/sitemap";
|
||||
import starlight from "@astrojs/starlight";
|
||||
import { defineConfig } from "astro/config";
|
||||
import remarkGithubAdmonitionsToDirectives from "remark-github-admonitions-to-directives";
|
||||
import pagefindResources from "./src/integrations/pagefind-resources";
|
||||
|
||||
// Learning Hub course content mirrored from external workshop repos is authored
|
||||
// in GitHub admonition syntax (`> [!NOTE]`). This remark plugin rewrites those
|
||||
// callouts into Starlight aside directives before Starlight renders them, so the
|
||||
// same syntax used in the source repos and on github.com also produces styled
|
||||
// callouts here. The mapping targets Starlight's aside types (note / tip / caution).
|
||||
const githubAdmonitionMapping = {
|
||||
NOTE: "note",
|
||||
TIP: "tip",
|
||||
IMPORTANT: "note",
|
||||
WARNING: "caution",
|
||||
CAUTION: "caution",
|
||||
};
|
||||
|
||||
const site = "https://awesome-copilot.github.com/";
|
||||
const siteDescription =
|
||||
"Community-contributed agents, instructions, and skills to enhance your GitHub Copilot experience";
|
||||
@@ -19,6 +33,11 @@ export default defineConfig({
|
||||
site,
|
||||
base: "/",
|
||||
output: "static",
|
||||
markdown: {
|
||||
remarkPlugins: [
|
||||
[remarkGithubAdmonitionsToDirectives, { mapping: githubAdmonitionMapping }],
|
||||
],
|
||||
},
|
||||
integrations: [
|
||||
starlight({
|
||||
title: "Awesome GitHub Copilot",
|
||||
@@ -66,6 +85,20 @@ export default defineConfig({
|
||||
"./src/styles/starlight-overrides.css",
|
||||
"./src/styles/global.css",
|
||||
],
|
||||
// English is served at the site root (no locale prefix), preserving all
|
||||
// existing URLs. Additional locales are served under a locale prefix
|
||||
// (e.g. /es-es/…) and fall back to the English page when a translation
|
||||
// does not yet exist. These keys match the locale directory names used by
|
||||
// mirrored Learning Hub course content (website/src/content/docs/<locale>/…).
|
||||
defaultLocale: "root",
|
||||
locales: {
|
||||
root: { label: "English", lang: "en" },
|
||||
"es-es": { label: "Español", lang: "es-ES" },
|
||||
"ja-jp": { label: "日本語", lang: "ja-JP" },
|
||||
"ko-kr": { label: "한국어", lang: "ko-KR" },
|
||||
"pt-br": { label: "Português (Brasil)", lang: "pt-BR" },
|
||||
"zh-cn": { label: "简体中文", lang: "zh-CN" },
|
||||
},
|
||||
editLink: {
|
||||
baseUrl:
|
||||
"https://github.com/github/awesome-copilot/edit/staged/website/",
|
||||
@@ -144,6 +177,7 @@ export default defineConfig({
|
||||
Head: "./src/components/Head.astro",
|
||||
Footer: "./src/components/Footer.astro",
|
||||
Search: "./src/components/Search.astro",
|
||||
LanguageSelect: "./src/components/LanguageSelect.astro",
|
||||
},
|
||||
}),
|
||||
sitemap(),
|
||||
|
||||
Generated
+16
@@ -18,6 +18,7 @@
|
||||
"isomorphic-dompurify": "^2.36.0",
|
||||
"jszip": "^3.10.1",
|
||||
"marked": "^18.0.2",
|
||||
"remark-github-admonitions-to-directives": "^2.1.0",
|
||||
"shiki": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
@@ -6491,6 +6492,21 @@
|
||||
"url": "https://opencollective.com/unified"
|
||||
}
|
||||
},
|
||||
"node_modules/remark-github-admonitions-to-directives": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/remark-github-admonitions-to-directives/-/remark-github-admonitions-to-directives-2.1.0.tgz",
|
||||
"integrity": "sha512-bI3E4Oj1pKY3ym2IQrrVCdORgEu0+mSrWgpCYFNy8QvytfnLs/nAacVPjkWU/JzDMUiQio2k4nTFP7bsIr9TSA==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@types/mdast": "^4.0.0",
|
||||
"mdast-util-directive": "^3.0.0",
|
||||
"unified": "^11.0.0",
|
||||
"unist-util-visit": "^5.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"pnpm": ">=9.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/remark-mdx": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/remark-mdx/-/remark-mdx-3.1.1.tgz",
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
"isomorphic-dompurify": "^2.36.0",
|
||||
"jszip": "^3.10.1",
|
||||
"marked": "^18.0.2",
|
||||
"remark-github-admonitions-to-directives": "^2.1.0",
|
||||
"shiki": "^4.0.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
---
|
||||
// Custom override of Starlight's LanguageSelect.
|
||||
//
|
||||
// By default Starlight renders the language dropdown on every page as soon as
|
||||
// more than one locale is configured. Most of this site's docs are English-only,
|
||||
// so we only want the picker to appear on pages that actually have a translation
|
||||
// in a non-English locale. This override checks the docs collection for a
|
||||
// translated version of the current page and renders the stock picker only when
|
||||
// one exists; otherwise it renders nothing (no dropdown).
|
||||
import Default from "@astrojs/starlight/components/LanguageSelect.astro";
|
||||
import config from "virtual:starlight/user-config";
|
||||
import { getCollection } from "astro:content";
|
||||
|
||||
// Locale directory names configured for the site, excluding the English root.
|
||||
const localeCodes = Object.keys(config.locales ?? {}).filter(
|
||||
(code) => code !== "root"
|
||||
);
|
||||
|
||||
/** Strip a leading `<locale>/` segment from a docs entry id, if present. */
|
||||
function baseSlug(id) {
|
||||
const [first, ...rest] = id.split("/");
|
||||
return localeCodes.includes(first) ? rest.join("/") : id;
|
||||
}
|
||||
|
||||
// Set of base slugs (locale-stripped) that have at least one non-English
|
||||
// translation available in the docs collection.
|
||||
const docs = await getCollection("docs");
|
||||
const translatedBaseSlugs = new Set();
|
||||
for (const entry of docs) {
|
||||
const [first, ...rest] = entry.id.split("/");
|
||||
if (localeCodes.includes(first)) {
|
||||
translatedBaseSlugs.add(rest.join("/"));
|
||||
}
|
||||
}
|
||||
|
||||
const currentBaseSlug = baseSlug(Astro.locals.starlightRoute.id);
|
||||
const hasTranslations = translatedBaseSlugs.has(currentBaseSlug);
|
||||
---
|
||||
|
||||
{hasTranslations && <Default {...Astro.props} />}
|
||||
Reference in New Issue
Block a user