mirror of
https://github.com/prdlk/leetcode.git
synced 2026-11-02 13:12:44 +00:00
feat(config): add repo link and actions to docs navigation
This commit is contained in:
1 parent
239c7013f8
commit
31054c01a7
1 file changed
+17
-8
@@ -1,7 +1,7 @@
|
||||
import { defineConfig } from "blume";
|
||||
import type { StandardSchema } from "blume/core/standard-schema.ts";
|
||||
import { hashText } from "blume/core/sources/cache.ts";
|
||||
import type { ContentSource } from "blume/core/sources/types.ts";
|
||||
import type { StandardSchema } from "blume/core/standard-schema.ts";
|
||||
import { custom, filesystem } from "blume/sources";
|
||||
import { githubReleasesSource } from "blume/sources/github-releases.ts";
|
||||
import redirects from "./redirects";
|
||||
@@ -59,9 +59,18 @@ const releasesByKind = (source: ContentSource): ContentSource => ({
|
||||
load: async () => {
|
||||
const result = await source.load();
|
||||
for (const entry of result.entries) {
|
||||
const kind = typeof entry.data.title === "string" ? entry.data.title.match(RELEASE_KIND)?.[1] : undefined;
|
||||
const kind =
|
||||
typeof entry.data.title === "string"
|
||||
? entry.data.title.match(RELEASE_KIND)?.[1]
|
||||
: undefined;
|
||||
const changelog = entry.data.changelog;
|
||||
if (!kind || !changelog || typeof changelog !== "object" || !("category" in changelog)) continue;
|
||||
if (
|
||||
!kind ||
|
||||
!changelog ||
|
||||
typeof changelog !== "object" ||
|
||||
!("category" in changelog)
|
||||
)
|
||||
continue;
|
||||
changelog.category = kind;
|
||||
if (entry.raw) {
|
||||
entry.raw = entry.raw.replace(/^( {2}category: ).*$/m, `$1${kind}`);
|
||||
@@ -70,7 +79,8 @@ const releasesByKind = (source: ContentSource): ContentSource => ({
|
||||
}
|
||||
return result;
|
||||
},
|
||||
withContext: source.withContext && ((ctx) => releasesByKind(source.withContext!(ctx))),
|
||||
withContext:
|
||||
source.withContext && ((ctx) => releasesByKind(source.withContext!(ctx))),
|
||||
});
|
||||
|
||||
// Blume's defaults (`inter`, `ibm-plex-mono`) are fetched from fonts.gstatic.com
|
||||
@@ -211,12 +221,11 @@ export default defineConfig({
|
||||
fonts: { display: inter, body: inter, mono: plexMono },
|
||||
},
|
||||
navigation: {
|
||||
repo: "https://github.com/prdlk/leetcode",
|
||||
actions: [{ href: "/changelog", label: "Changelog" }],
|
||||
sidebar: {
|
||||
display: "flat", // "flat" | "group" | "page"
|
||||
},
|
||||
tabs: [
|
||||
{ label: "Guides", path: "/guides" },
|
||||
{ label: "Changelog", path: "/changelog" },
|
||||
],
|
||||
tabs: [{ label: "Guides", path: "/guides" }],
|
||||
},
|
||||
});
|
||||
Reference in new issue
Block a user