blume 0.0.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/blume.mjs +18 -0
- package/dist/cli/index.js +12696 -0
- package/dist/cli/index.js.map +145 -0
- package/dist/types/core/bridge.d.ts +24 -0
- package/dist/types/core/config.d.ts +35 -0
- package/dist/types/core/data.d.ts +129 -0
- package/dist/types/core/define-components.d.ts +27 -0
- package/dist/types/core/define-meta.d.ts +16 -0
- package/dist/types/core/deployment-env.d.ts +9 -0
- package/dist/types/core/diagnostics.d.ts +17 -0
- package/dist/types/core/i18n-ui.d.ts +500 -0
- package/dist/types/core/load-module.d.ts +7 -0
- package/dist/types/core/package-root.d.ts +17 -0
- package/dist/types/core/project.d.ts +9 -0
- package/dist/types/core/schema.d.ts +3451 -0
- package/dist/types/core/sources/types.d.ts +107 -0
- package/dist/types/core/types.d.ts +245 -0
- package/dist/types/core/ui-packs/ar.d.ts +3 -0
- package/dist/types/core/ui-packs/bg.d.ts +3 -0
- package/dist/types/core/ui-packs/bn.d.ts +3 -0
- package/dist/types/core/ui-packs/ca.d.ts +3 -0
- package/dist/types/core/ui-packs/cs.d.ts +3 -0
- package/dist/types/core/ui-packs/da.d.ts +3 -0
- package/dist/types/core/ui-packs/de.d.ts +3 -0
- package/dist/types/core/ui-packs/el.d.ts +3 -0
- package/dist/types/core/ui-packs/es.d.ts +3 -0
- package/dist/types/core/ui-packs/fa.d.ts +3 -0
- package/dist/types/core/ui-packs/fi.d.ts +3 -0
- package/dist/types/core/ui-packs/fr.d.ts +3 -0
- package/dist/types/core/ui-packs/he.d.ts +3 -0
- package/dist/types/core/ui-packs/hi.d.ts +3 -0
- package/dist/types/core/ui-packs/hr.d.ts +3 -0
- package/dist/types/core/ui-packs/hu.d.ts +3 -0
- package/dist/types/core/ui-packs/id.d.ts +3 -0
- package/dist/types/core/ui-packs/index.d.ts +13 -0
- package/dist/types/core/ui-packs/it.d.ts +3 -0
- package/dist/types/core/ui-packs/ja.d.ts +3 -0
- package/dist/types/core/ui-packs/ko.d.ts +3 -0
- package/dist/types/core/ui-packs/nl.d.ts +3 -0
- package/dist/types/core/ui-packs/no.d.ts +3 -0
- package/dist/types/core/ui-packs/pl.d.ts +3 -0
- package/dist/types/core/ui-packs/pt-br.d.ts +3 -0
- package/dist/types/core/ui-packs/pt.d.ts +3 -0
- package/dist/types/core/ui-packs/ro.d.ts +3 -0
- package/dist/types/core/ui-packs/ru.d.ts +3 -0
- package/dist/types/core/ui-packs/sk.d.ts +3 -0
- package/dist/types/core/ui-packs/sr.d.ts +3 -0
- package/dist/types/core/ui-packs/sv.d.ts +3 -0
- package/dist/types/core/ui-packs/th.d.ts +3 -0
- package/dist/types/core/ui-packs/tr.d.ts +3 -0
- package/dist/types/core/ui-packs/uk.d.ts +3 -0
- package/dist/types/core/ui-packs/vi.d.ts +3 -0
- package/dist/types/core/ui-packs/zh-tw.d.ts +3 -0
- package/dist/types/core/ui-packs/zh.d.ts +3 -0
- package/dist/types/core/version.d.ts +8 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/migrate/mintlify/config.d.ts +2 -0
- package/dist/types/migrate/mintlify/i18n.d.ts +7 -0
- package/dist/types/theme/fonts.d.ts +163 -0
- package/docs/01-quickstart.mdx +99 -0
- package/docs/02-deployment.mdx +129 -0
- package/docs/advanced/api-reference.mdx +114 -0
- package/docs/advanced/blog.mdx +121 -0
- package/docs/advanced/changelog.mdx +113 -0
- package/docs/advanced/custom-pages.mdx +268 -0
- package/docs/advanced/meta.ts +7 -0
- package/docs/changelog/v0-1-0.mdx +12 -0
- package/docs/changelog/v0-2-0.mdx +16 -0
- package/docs/configuration/ai.mdx +228 -0
- package/docs/configuration/analytics.mdx +98 -0
- package/docs/configuration/customization.mdx +91 -0
- package/docs/configuration/export.mdx +70 -0
- package/docs/configuration/index.mdx +290 -0
- package/docs/configuration/meta.ts +15 -0
- package/docs/configuration/search.mdx +172 -0
- package/docs/configuration/seo.mdx +196 -0
- package/docs/configuration/theming.mdx +178 -0
- package/docs/content/components.mdx +651 -0
- package/docs/content/i18n.mdx +205 -0
- package/docs/content/index.mdx +161 -0
- package/docs/content/islands.mdx +94 -0
- package/docs/content/meta.mdx +119 -0
- package/docs/content/meta.ts +15 -0
- package/docs/content/navigation.mdx +168 -0
- package/docs/content/sources.mdx +216 -0
- package/docs/content/syntax.mdx +445 -0
- package/docs/index.mdx +112 -0
- package/docs/reference/cli.mdx +43 -0
- package/docs/reference/frontmatter.mdx +74 -0
- package/docs/reference/meta.ts +7 -0
- package/package.json +150 -6
- package/src/ai/ask.ts +93 -0
- package/src/ai/llms.ts +64 -0
- package/src/ai/markdown.ts +31 -0
- package/src/ai/mcp/data.ts +74 -0
- package/src/ai/mcp/discovery.ts +49 -0
- package/src/ai/mcp/server.ts +225 -0
- package/src/ai/mcp/tools.ts +47 -0
- package/src/assets/icon.png +0 -0
- package/src/astro/examples.ts +104 -0
- package/src/astro/generate.ts +1006 -0
- package/src/astro/index.ts +4 -0
- package/src/astro/integration.ts +74 -0
- package/src/astro/islands.ts +131 -0
- package/src/astro/markdown-negotiation.ts +68 -0
- package/src/astro/pages.ts +87 -0
- package/src/astro/templates.ts +1326 -0
- package/src/cli/commands/add.ts +81 -0
- package/src/cli/commands/build.ts +103 -0
- package/src/cli/commands/dev.ts +108 -0
- package/src/cli/commands/doctor.ts +74 -0
- package/src/cli/commands/eject.ts +57 -0
- package/src/cli/commands/init.ts +98 -0
- package/src/cli/commands/migrate.ts +39 -0
- package/src/cli/commands/preview.ts +39 -0
- package/src/cli/commands/sync.ts +52 -0
- package/src/cli/commands/validate.ts +61 -0
- package/src/cli/index.ts +35 -0
- package/src/cli/log.ts +37 -0
- package/src/cli/prepare.ts +80 -0
- package/src/components/Icon.astro +99 -0
- package/src/components/content/Accordion.astro +8 -0
- package/src/components/content/AccordionItem.astro +121 -0
- package/src/components/content/AutoTypeTable.astro +51 -0
- package/src/components/content/Badge.astro +124 -0
- package/src/components/content/Callout.astro +73 -0
- package/src/components/content/Card.astro +104 -0
- package/src/components/content/CardGroup.astro +14 -0
- package/src/components/content/CodeBlock.astro +28 -0
- package/src/components/content/CodeGroup.astro +13 -0
- package/src/components/content/Color.astro +15 -0
- package/src/components/content/ColorItem.astro +87 -0
- package/src/components/content/ColorRow.astro +10 -0
- package/src/components/content/Column.astro +6 -0
- package/src/components/content/Columns.astro +9 -0
- package/src/components/content/Component.astro +65 -0
- package/src/components/content/Diff.astro +44 -0
- package/src/components/content/Expandable.astro +11 -0
- package/src/components/content/FileTree.astro +8 -0
- package/src/components/content/Frame.astro +70 -0
- package/src/components/content/GithubInfo.astro +110 -0
- package/src/components/content/Math.astro +24 -0
- package/src/components/content/Panel.astro +20 -0
- package/src/components/content/Prompt.astro +129 -0
- package/src/components/content/Step.astro +34 -0
- package/src/components/content/Steps.astro +20 -0
- package/src/components/content/Tab.astro +46 -0
- package/src/components/content/Tabs.astro +273 -0
- package/src/components/content/Tile.astro +42 -0
- package/src/components/content/Tooltip.astro +68 -0
- package/src/components/content/Tree.astro +300 -0
- package/src/components/content/TreeFile.astro +15 -0
- package/src/components/content/TreeFolder.astro +62 -0
- package/src/components/content/TypeTable.astro +106 -0
- package/src/components/content/Update.astro +66 -0
- package/src/components/content/Visibility.astro +12 -0
- package/src/components/content/Warning.astro +9 -0
- package/src/components/content/auto-type-table.ts +141 -0
- package/src/components/content/diff.ts +95 -0
- package/src/components/content/github-info.ts +79 -0
- package/src/components/content/mermaid-element.ts +68 -0
- package/src/components/github-mark.ts +9 -0
- package/src/components/index.ts +14 -0
- package/src/components/islands/AskAI.astro +12 -0
- package/src/components/islands/ask-ai.tsx +156 -0
- package/src/components/layout/Analytics.astro +63 -0
- package/src/components/layout/Banner.astro +50 -0
- package/src/components/layout/Breadcrumbs.astro +31 -0
- package/src/components/layout/Favicon.astro +22 -0
- package/src/components/layout/Fonts.astro +14 -0
- package/src/components/layout/Header.astro +188 -0
- package/src/components/layout/LanguageSwitcher.astro +56 -0
- package/src/components/layout/NavTree.astro +462 -0
- package/src/components/layout/PageActions.astro +438 -0
- package/src/components/layout/PageFeedback.astro +58 -0
- package/src/components/layout/PageLayout.astro +173 -0
- package/src/components/layout/Pagination.astro +56 -0
- package/src/components/layout/ReferenceLayout.astro +107 -0
- package/src/components/layout/RootLayout.astro +537 -0
- package/src/components/layout/Search.astro +608 -0
- package/src/components/layout/TableOfContents.astro +68 -0
- package/src/components/layout/analytics-client.ts +38 -0
- package/src/components/layout/head-scripts.ts +19 -0
- package/src/components/layout/nav-utils.ts +87 -0
- package/src/components/layout/overrides.ts +32 -0
- package/src/components/layout/search/algolia.ts +43 -0
- package/src/components/layout/search/endpoint.ts +22 -0
- package/src/components/layout/search/flexsearch.ts +52 -0
- package/src/components/layout/search/orama-cloud.ts +41 -0
- package/src/components/layout/search/orama.ts +26 -0
- package/src/components/layout/search/pagefind.ts +43 -0
- package/src/components/layout/search/types.ts +163 -0
- package/src/components/layout/search/typesense.ts +60 -0
- package/src/components/layout/toc-element.ts +108 -0
- package/src/core/bridge.ts +92 -0
- package/src/core/config.ts +112 -0
- package/src/core/content.ts +50 -0
- package/src/core/data.ts +128 -0
- package/src/core/define-components.ts +34 -0
- package/src/core/define-meta.ts +20 -0
- package/src/core/deployment-env.ts +73 -0
- package/src/core/diagnostics.ts +104 -0
- package/src/core/frontmatter.ts +43 -0
- package/src/core/graph.ts +128 -0
- package/src/core/i18n-ui.ts +171 -0
- package/src/core/i18n.ts +169 -0
- package/src/core/last-modified.ts +88 -0
- package/src/core/links.ts +352 -0
- package/src/core/load-module.ts +15 -0
- package/src/core/manifest.ts +126 -0
- package/src/core/meta.ts +97 -0
- package/src/core/navigation.ts +392 -0
- package/src/core/package-root.ts +37 -0
- package/src/core/project-graph.ts +153 -0
- package/src/core/project.ts +56 -0
- package/src/core/schema.ts +1057 -0
- package/src/core/server-features.ts +23 -0
- package/src/core/sources/assets.ts +77 -0
- package/src/core/sources/cache.ts +122 -0
- package/src/core/sources/filesystem.ts +99 -0
- package/src/core/sources/mdx-remote.ts +215 -0
- package/src/core/sources/mintlify.ts +161 -0
- package/src/core/sources/normalize.ts +243 -0
- package/src/core/sources/notion.ts +440 -0
- package/src/core/sources/portable-text.ts +143 -0
- package/src/core/sources/read.ts +36 -0
- package/src/core/sources/resolve.ts +158 -0
- package/src/core/sources/sanity.ts +218 -0
- package/src/core/sources/types.ts +105 -0
- package/src/core/tsconfig-aliases.ts +201 -0
- package/src/core/types.ts +261 -0
- package/src/core/ui-packs/ar.ts +47 -0
- package/src/core/ui-packs/bg.ts +47 -0
- package/src/core/ui-packs/bn.ts +47 -0
- package/src/core/ui-packs/ca.ts +47 -0
- package/src/core/ui-packs/cs.ts +47 -0
- package/src/core/ui-packs/da.ts +47 -0
- package/src/core/ui-packs/de.ts +47 -0
- package/src/core/ui-packs/el.ts +47 -0
- package/src/core/ui-packs/es.ts +47 -0
- package/src/core/ui-packs/fa.ts +47 -0
- package/src/core/ui-packs/fi.ts +47 -0
- package/src/core/ui-packs/fr.ts +47 -0
- package/src/core/ui-packs/he.ts +47 -0
- package/src/core/ui-packs/hi.ts +47 -0
- package/src/core/ui-packs/hr.ts +47 -0
- package/src/core/ui-packs/hu.ts +47 -0
- package/src/core/ui-packs/id.ts +47 -0
- package/src/core/ui-packs/index.ts +87 -0
- package/src/core/ui-packs/it.ts +47 -0
- package/src/core/ui-packs/ja.ts +47 -0
- package/src/core/ui-packs/ko.ts +47 -0
- package/src/core/ui-packs/nl.ts +47 -0
- package/src/core/ui-packs/no.ts +47 -0
- package/src/core/ui-packs/pl.ts +47 -0
- package/src/core/ui-packs/pt-br.ts +47 -0
- package/src/core/ui-packs/pt.ts +47 -0
- package/src/core/ui-packs/ro.ts +47 -0
- package/src/core/ui-packs/ru.ts +47 -0
- package/src/core/ui-packs/sk.ts +47 -0
- package/src/core/ui-packs/sr.ts +47 -0
- package/src/core/ui-packs/sv.ts +47 -0
- package/src/core/ui-packs/th.ts +47 -0
- package/src/core/ui-packs/tr.ts +47 -0
- package/src/core/ui-packs/uk.ts +47 -0
- package/src/core/ui-packs/vi.ts +47 -0
- package/src/core/ui-packs/zh-tw.ts +47 -0
- package/src/core/ui-packs/zh.ts +47 -0
- package/src/core/version.ts +23 -0
- package/src/deploy/robots.ts +20 -0
- package/src/deploy/rss.ts +128 -0
- package/src/deploy/sitemap.ts +28 -0
- package/src/index.ts +39 -0
- package/src/markdown/code-title.ts +71 -0
- package/src/markdown/directives.ts +83 -0
- package/src/markdown/heading-anchors.ts +137 -0
- package/src/markdown/index.ts +228 -0
- package/src/markdown/inline-code.ts +108 -0
- package/src/markdown/language-icon.ts +172 -0
- package/src/markdown/math.ts +32 -0
- package/src/markdown/mdast.ts +48 -0
- package/src/markdown/mermaid.ts +37 -0
- package/src/markdown/package-commands.ts +159 -0
- package/src/markdown/package-install.ts +40 -0
- package/src/migrate/fumadocs/config.ts +155 -0
- package/src/migrate/fumadocs/content.ts +365 -0
- package/src/migrate/fumadocs/frontmatter.ts +18 -0
- package/src/migrate/fumadocs/groups.ts +230 -0
- package/src/migrate/fumadocs/index.ts +337 -0
- package/src/migrate/fumadocs/meta.ts +244 -0
- package/src/migrate/migrate.ts +53 -0
- package/src/migrate/mintlify/config.ts +1040 -0
- package/src/migrate/mintlify/content.ts +98 -0
- package/src/migrate/mintlify/frontmatter.ts +126 -0
- package/src/migrate/mintlify/i18n.ts +51 -0
- package/src/migrate/mintlify/icons.ts +128 -0
- package/src/migrate/mintlify/index.ts +266 -0
- package/src/migrate/mintlify/snippets.ts +306 -0
- package/src/migrate/mintlify/transform.ts +80 -0
- package/src/migrate/nextra/content.ts +46 -0
- package/src/migrate/nextra/frontmatter.ts +40 -0
- package/src/migrate/nextra/index.ts +374 -0
- package/src/migrate/nextra/meta.ts +266 -0
- package/src/migrate/shared.ts +720 -0
- package/src/migrate/starlight/config.ts +459 -0
- package/src/migrate/starlight/content.ts +78 -0
- package/src/migrate/starlight/frontmatter.ts +111 -0
- package/src/migrate/starlight/i18n.ts +54 -0
- package/src/migrate/starlight/index.ts +131 -0
- package/src/og/card.ts +92 -0
- package/src/og/index.ts +2 -0
- package/src/openapi/scalar.ts +246 -0
- package/src/registry/eject.ts +310 -0
- package/src/registry/registry.ts +100 -0
- package/src/registry/rewrite-imports.ts +39 -0
- package/src/runtime/index.ts +14 -0
- package/src/search/build.ts +23 -0
- package/src/search/documents.ts +164 -0
- package/src/search/orama-index.ts +66 -0
- package/src/search/providers.ts +91 -0
- package/src/search/sync/algolia.ts +30 -0
- package/src/search/sync/index.ts +50 -0
- package/src/search/sync/orama-cloud.ts +40 -0
- package/src/search/sync/typesense.ts +65 -0
- package/src/seo/jsonld.ts +113 -0
- package/src/theme/entry.ts +637 -0
- package/src/theme/fonts.ts +198 -0
- package/src/theme/icons.ts +184 -0
- package/src/theme/palette.ts +143 -0
- package/src/theme/twoslash.ts +81 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Swedish (sv) UI strings. */
|
|
4
|
+
export const sv: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "Lägg till i Cursor",
|
|
7
|
+
addToVscode: "Lägg till i VS Code",
|
|
8
|
+
askAI: "Fråga AI om den här sidan",
|
|
9
|
+
connectMcp: "Anslut till MCP",
|
|
10
|
+
copied: "Kopierat!",
|
|
11
|
+
copyClaudeCode: "Kopiera Claude Code-kommando",
|
|
12
|
+
copyMarkdown: "Kopiera som Markdown",
|
|
13
|
+
copyServerUrl: "Kopiera server-URL",
|
|
14
|
+
edit: "Redigera på GitHub",
|
|
15
|
+
openInChat: "Öppna i chatt",
|
|
16
|
+
scrollToTop: "Till toppen",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "Ställ en fråga om dokumentationen.",
|
|
20
|
+
error: "Tyvärr, något gick fel.",
|
|
21
|
+
label: "Ställ en fråga",
|
|
22
|
+
placeholder: "Ställ en fråga…",
|
|
23
|
+
send: "Skicka",
|
|
24
|
+
title: "Fråga AI",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "Nej",
|
|
28
|
+
question: "Var den här sidan till hjälp?",
|
|
29
|
+
thanks: "Tack för din feedback!",
|
|
30
|
+
yes: "Ja",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "Språk", untranslated: "Inte översatt" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "Senast uppdaterad",
|
|
35
|
+
next: "Nästa",
|
|
36
|
+
previous: "Föregående",
|
|
37
|
+
skipToContent: "Hoppa till innehåll",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "Sök",
|
|
41
|
+
devOnly: "Sökning är tillgänglig i produktionsbygget.",
|
|
42
|
+
label: "Sök i dokumentationen",
|
|
43
|
+
noResults: "Inga resultat hittades.",
|
|
44
|
+
placeholder: "Sök i dokumentationen…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "På den här sidan" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Thai (th) UI strings. */
|
|
4
|
+
export const th: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "เพิ่มไปยัง Cursor",
|
|
7
|
+
addToVscode: "เพิ่มไปยัง VS Code",
|
|
8
|
+
askAI: "ถาม AI เกี่ยวกับหน้านี้",
|
|
9
|
+
connectMcp: "เชื่อมต่อกับ MCP",
|
|
10
|
+
copied: "คัดลอกแล้ว!",
|
|
11
|
+
copyClaudeCode: "คัดลอกคำสั่ง Claude Code",
|
|
12
|
+
copyMarkdown: "คัดลอกเป็น Markdown",
|
|
13
|
+
copyServerUrl: "คัดลอก URL ของเซิร์ฟเวอร์",
|
|
14
|
+
edit: "แก้ไขบน GitHub",
|
|
15
|
+
openInChat: "เปิดในแชท",
|
|
16
|
+
scrollToTop: "กลับไปด้านบน",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "ถามคำถามเกี่ยวกับเอกสาร",
|
|
20
|
+
error: "ขออภัย เกิดข้อผิดพลาดบางอย่าง",
|
|
21
|
+
label: "ถามคำถาม",
|
|
22
|
+
placeholder: "ถามคำถาม…",
|
|
23
|
+
send: "ส่ง",
|
|
24
|
+
title: "ถาม AI",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "ไม่",
|
|
28
|
+
question: "หน้านี้มีประโยชน์หรือไม่?",
|
|
29
|
+
thanks: "ขอบคุณสำหรับความคิดเห็นของคุณ!",
|
|
30
|
+
yes: "ใช่",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "ภาษา", untranslated: "ยังไม่ได้แปล" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "อัปเดตล่าสุดเมื่อ",
|
|
35
|
+
next: "ถัดไป",
|
|
36
|
+
previous: "ก่อนหน้า",
|
|
37
|
+
skipToContent: "ข้ามไปยังเนื้อหา",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "ค้นหา",
|
|
41
|
+
devOnly: "การค้นหาพร้อมใช้งานในบิลด์โปรดักชัน",
|
|
42
|
+
label: "ค้นหาเอกสาร",
|
|
43
|
+
noResults: "ไม่พบผลลัพธ์",
|
|
44
|
+
placeholder: "ค้นหาเอกสาร…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "ในหน้านี้" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Turkish (tr) UI strings. */
|
|
4
|
+
export const tr: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "Cursor'a ekle",
|
|
7
|
+
addToVscode: "VS Code'a ekle",
|
|
8
|
+
askAI: "Bu sayfa hakkında yapay zekâya sor",
|
|
9
|
+
connectMcp: "MCP'ye bağlan",
|
|
10
|
+
copied: "Kopyalandı!",
|
|
11
|
+
copyClaudeCode: "Claude Code komutunu kopyala",
|
|
12
|
+
copyMarkdown: "Markdown olarak kopyala",
|
|
13
|
+
copyServerUrl: "Sunucu URL'sini kopyala",
|
|
14
|
+
edit: "GitHub'da düzenle",
|
|
15
|
+
openInChat: "Sohbette aç",
|
|
16
|
+
scrollToTop: "Başa dön",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "Belgeler hakkında bir soru sorun.",
|
|
20
|
+
error: "Üzgünüz, bir şeyler ters gitti.",
|
|
21
|
+
label: "Bir soru sorun",
|
|
22
|
+
placeholder: "Bir soru sorun…",
|
|
23
|
+
send: "Gönder",
|
|
24
|
+
title: "Yapay zekâya sor",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "Hayır",
|
|
28
|
+
question: "Bu sayfa yardımcı oldu mu?",
|
|
29
|
+
thanks: "Geri bildiriminiz için teşekkürler!",
|
|
30
|
+
yes: "Evet",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "Dil", untranslated: "Çevrilmemiş" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "Son güncelleme",
|
|
35
|
+
next: "Sonraki",
|
|
36
|
+
previous: "Önceki",
|
|
37
|
+
skipToContent: "İçeriğe geç",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "Ara",
|
|
41
|
+
devOnly: "Arama, üretim derlemesinde kullanılabilir.",
|
|
42
|
+
label: "Belgelerde ara",
|
|
43
|
+
noResults: "Sonuç bulunamadı.",
|
|
44
|
+
placeholder: "Belgelerde ara…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "Bu sayfada" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Ukrainian (uk) UI strings. */
|
|
4
|
+
export const uk: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "Додати до Cursor",
|
|
7
|
+
addToVscode: "Додати до VS Code",
|
|
8
|
+
askAI: "Запитати ШІ про цю сторінку",
|
|
9
|
+
connectMcp: "Підключитися до MCP",
|
|
10
|
+
copied: "Скопійовано!",
|
|
11
|
+
copyClaudeCode: "Скопіювати команду Claude Code",
|
|
12
|
+
copyMarkdown: "Скопіювати як Markdown",
|
|
13
|
+
copyServerUrl: "Скопіювати URL сервера",
|
|
14
|
+
edit: "Редагувати на GitHub",
|
|
15
|
+
openInChat: "Відкрити в чаті",
|
|
16
|
+
scrollToTop: "Нагору",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "Поставте запитання щодо документації.",
|
|
20
|
+
error: "Вибачте, щось пішло не так.",
|
|
21
|
+
label: "Поставити запитання",
|
|
22
|
+
placeholder: "Поставте запитання…",
|
|
23
|
+
send: "Надіслати",
|
|
24
|
+
title: "Запитати ШІ",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "Ні",
|
|
28
|
+
question: "Чи була ця сторінка корисною?",
|
|
29
|
+
thanks: "Дякуємо за ваш відгук!",
|
|
30
|
+
yes: "Так",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "Мова", untranslated: "Не перекладено" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "Останнє оновлення",
|
|
35
|
+
next: "Далі",
|
|
36
|
+
previous: "Назад",
|
|
37
|
+
skipToContent: "Перейти до вмісту",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "Пошук",
|
|
41
|
+
devOnly: "Пошук доступний у production-збірці.",
|
|
42
|
+
label: "Пошук у документації",
|
|
43
|
+
noResults: "Нічого не знайдено.",
|
|
44
|
+
placeholder: "Пошук у документації…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "На цій сторінці" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Vietnamese (vi) UI strings. */
|
|
4
|
+
export const vi: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "Thêm vào Cursor",
|
|
7
|
+
addToVscode: "Thêm vào VS Code",
|
|
8
|
+
askAI: "Hỏi AI về trang này",
|
|
9
|
+
connectMcp: "Kết nối với MCP",
|
|
10
|
+
copied: "Đã sao chép!",
|
|
11
|
+
copyClaudeCode: "Sao chép lệnh Claude Code",
|
|
12
|
+
copyMarkdown: "Sao chép dưới dạng Markdown",
|
|
13
|
+
copyServerUrl: "Sao chép URL máy chủ",
|
|
14
|
+
edit: "Chỉnh sửa trên GitHub",
|
|
15
|
+
openInChat: "Mở trong trò chuyện",
|
|
16
|
+
scrollToTop: "Lên đầu trang",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "Đặt câu hỏi về tài liệu.",
|
|
20
|
+
error: "Xin lỗi, đã xảy ra sự cố.",
|
|
21
|
+
label: "Đặt câu hỏi",
|
|
22
|
+
placeholder: "Đặt câu hỏi…",
|
|
23
|
+
send: "Gửi",
|
|
24
|
+
title: "Hỏi AI",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "Không",
|
|
28
|
+
question: "Trang này có hữu ích không?",
|
|
29
|
+
thanks: "Cảm ơn phản hồi của bạn!",
|
|
30
|
+
yes: "Có",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "Ngôn ngữ", untranslated: "Chưa dịch" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "Cập nhật lần cuối",
|
|
35
|
+
next: "Tiếp theo",
|
|
36
|
+
previous: "Trước",
|
|
37
|
+
skipToContent: "Chuyển đến nội dung",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "Tìm kiếm",
|
|
41
|
+
devOnly: "Tìm kiếm có sẵn trong bản dựng production.",
|
|
42
|
+
label: "Tìm kiếm tài liệu",
|
|
43
|
+
noResults: "Không tìm thấy kết quả.",
|
|
44
|
+
placeholder: "Tìm kiếm tài liệu…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "Trên trang này" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Chinese — Traditional (zh-TW) UI strings. */
|
|
4
|
+
export const zhTW: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "新增至 Cursor",
|
|
7
|
+
addToVscode: "新增至 VS Code",
|
|
8
|
+
askAI: "向 AI 詢問此頁面",
|
|
9
|
+
connectMcp: "連線至 MCP",
|
|
10
|
+
copied: "已複製!",
|
|
11
|
+
copyClaudeCode: "複製 Claude Code 指令",
|
|
12
|
+
copyMarkdown: "複製為 Markdown",
|
|
13
|
+
copyServerUrl: "複製伺服器 URL",
|
|
14
|
+
edit: "在 GitHub 上編輯",
|
|
15
|
+
openInChat: "在聊天中開啟",
|
|
16
|
+
scrollToTop: "回到頂部",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "針對文件提出問題。",
|
|
20
|
+
error: "抱歉,發生了一些問題。",
|
|
21
|
+
label: "提出問題",
|
|
22
|
+
placeholder: "提出問題…",
|
|
23
|
+
send: "傳送",
|
|
24
|
+
title: "向 AI 提問",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "沒有幫助",
|
|
28
|
+
question: "這個頁面有幫助嗎?",
|
|
29
|
+
thanks: "感謝你的意見回饋!",
|
|
30
|
+
yes: "有幫助",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "語言", untranslated: "未翻譯" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "最後更新於",
|
|
35
|
+
next: "下一頁",
|
|
36
|
+
previous: "上一頁",
|
|
37
|
+
skipToContent: "跳至內容",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "搜尋",
|
|
41
|
+
devOnly: "搜尋在正式版組建中可用。",
|
|
42
|
+
label: "搜尋文件",
|
|
43
|
+
noResults: "找不到結果。",
|
|
44
|
+
placeholder: "搜尋文件…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "本頁內容" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { UIStringsOverride } from "../i18n-ui.ts";
|
|
2
|
+
|
|
3
|
+
/** Chinese — Simplified (zh) UI strings. */
|
|
4
|
+
export const zh: UIStringsOverride = {
|
|
5
|
+
actions: {
|
|
6
|
+
addToCursor: "添加到 Cursor",
|
|
7
|
+
addToVscode: "添加到 VS Code",
|
|
8
|
+
askAI: "向 AI 询问此页面",
|
|
9
|
+
connectMcp: "连接到 MCP",
|
|
10
|
+
copied: "已复制!",
|
|
11
|
+
copyClaudeCode: "复制 Claude Code 命令",
|
|
12
|
+
copyMarkdown: "复制为 Markdown",
|
|
13
|
+
copyServerUrl: "复制服务器 URL",
|
|
14
|
+
edit: "在 GitHub 上编辑",
|
|
15
|
+
openInChat: "在聊天中打开",
|
|
16
|
+
scrollToTop: "回到顶部",
|
|
17
|
+
},
|
|
18
|
+
ask: {
|
|
19
|
+
empty: "就文档提出问题。",
|
|
20
|
+
error: "抱歉,出了点问题。",
|
|
21
|
+
label: "提出问题",
|
|
22
|
+
placeholder: "提出问题…",
|
|
23
|
+
send: "发送",
|
|
24
|
+
title: "向 AI 提问",
|
|
25
|
+
},
|
|
26
|
+
feedback: {
|
|
27
|
+
no: "没有帮助",
|
|
28
|
+
question: "这个页面有帮助吗?",
|
|
29
|
+
thanks: "感谢你的反馈!",
|
|
30
|
+
yes: "有帮助",
|
|
31
|
+
},
|
|
32
|
+
languageSwitcher: { label: "语言", untranslated: "未翻译" },
|
|
33
|
+
page: {
|
|
34
|
+
lastUpdated: "最后更新于",
|
|
35
|
+
next: "下一页",
|
|
36
|
+
previous: "上一页",
|
|
37
|
+
skipToContent: "跳到内容",
|
|
38
|
+
},
|
|
39
|
+
search: {
|
|
40
|
+
button: "搜索",
|
|
41
|
+
devOnly: "搜索在生产构建中可用。",
|
|
42
|
+
label: "搜索文档",
|
|
43
|
+
noResults: "未找到结果。",
|
|
44
|
+
placeholder: "搜索文档…",
|
|
45
|
+
},
|
|
46
|
+
toc: { title: "本页内容" },
|
|
47
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
|
|
3
|
+
import { join } from "pathe";
|
|
4
|
+
|
|
5
|
+
import { packageRoot } from "./package-root.ts";
|
|
6
|
+
|
|
7
|
+
let cached: string | undefined;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The installed Blume package version, read lazily from its `package.json`.
|
|
11
|
+
*
|
|
12
|
+
* Computed on demand (not at module load) so importing the `blume` barrel has no
|
|
13
|
+
* filesystem side effect, and anchored at the package root so it resolves the
|
|
14
|
+
* same whether running from source or the bundled CLI.
|
|
15
|
+
*/
|
|
16
|
+
export const getBlumeVersion = (): string => {
|
|
17
|
+
if (cached === undefined) {
|
|
18
|
+
const pkgPath = join(packageRoot(), "package.json");
|
|
19
|
+
cached = (JSON.parse(readFileSync(pkgPath, "utf-8")) as { version: string })
|
|
20
|
+
.version;
|
|
21
|
+
}
|
|
22
|
+
return cached;
|
|
23
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { BlumeProject } from "../core/project-graph.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build a robots.txt that allows all crawlers and points to the sitemap when
|
|
5
|
+
* one is available (a `site` is set and the sitemap is enabled). Returns null
|
|
6
|
+
* when robots generation is disabled.
|
|
7
|
+
*/
|
|
8
|
+
export const buildRobots = (project: BlumeProject): string | null => {
|
|
9
|
+
const { config } = project;
|
|
10
|
+
if (!config.seo.robots) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const lines = ["User-agent: *", "Allow: /"];
|
|
15
|
+
const { site } = config.deployment;
|
|
16
|
+
if (site && config.seo.sitemap) {
|
|
17
|
+
lines.push("", `Sitemap: ${site.replace(/\/$/u, "")}/sitemap.xml`);
|
|
18
|
+
}
|
|
19
|
+
return `${lines.join("\n")}\n`;
|
|
20
|
+
};
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import type { BlumeProject } from "../core/project-graph.ts";
|
|
2
|
+
import type { PageRecord } from "../core/types.ts";
|
|
3
|
+
|
|
4
|
+
/** A single feed entry derived from a content page. */
|
|
5
|
+
export interface RssItem {
|
|
6
|
+
title: string;
|
|
7
|
+
/** Absolute item URL. */
|
|
8
|
+
link: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
/** Publish date, when the page declares one. */
|
|
11
|
+
date?: Date;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** A resolved RSS feed for one content type. */
|
|
15
|
+
export interface RssFeed {
|
|
16
|
+
/** Content type the feed covers, e.g. `blog`. */
|
|
17
|
+
type: string;
|
|
18
|
+
/** Feed URL path, e.g. `/blog/rss.xml`. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** Channel title, e.g. `Blume — Blog`. */
|
|
21
|
+
title: string;
|
|
22
|
+
/** Absolute site link. */
|
|
23
|
+
link: string;
|
|
24
|
+
description?: string;
|
|
25
|
+
items: RssItem[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const capitalize = (value: string): string =>
|
|
29
|
+
value.charAt(0).toUpperCase() + value.slice(1);
|
|
30
|
+
|
|
31
|
+
/** Publish date for a page: top-level `date`, else `changelog.date`. */
|
|
32
|
+
const pageDate = (page: PageRecord): Date | undefined => {
|
|
33
|
+
const raw = page.meta.date ?? page.meta.changelog?.date;
|
|
34
|
+
if (!raw) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const date = new Date(raw);
|
|
38
|
+
return Number.isNaN(date.getTime()) ? undefined : date;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Build an RSS feed per configured content type that has publishable pages.
|
|
43
|
+
* Returns an empty list when RSS is disabled or no `deployment.site` is set —
|
|
44
|
+
* absolute URLs are required for a valid feed, mirroring `buildSitemap`.
|
|
45
|
+
*/
|
|
46
|
+
export const buildRssFeeds = (project: BlumeProject): RssFeed[] => {
|
|
47
|
+
const { config } = project;
|
|
48
|
+
const { rss } = config.seo;
|
|
49
|
+
const { site } = config.deployment;
|
|
50
|
+
if (!(rss.enabled && site)) {
|
|
51
|
+
return [];
|
|
52
|
+
}
|
|
53
|
+
const base = site.replace(/\/$/u, "");
|
|
54
|
+
|
|
55
|
+
const feeds: RssFeed[] = [];
|
|
56
|
+
for (const type of rss.types) {
|
|
57
|
+
const pages = project.graph.pages.filter(
|
|
58
|
+
(page) =>
|
|
59
|
+
page.contentType === type &&
|
|
60
|
+
!(page.meta.draft || page.meta.sidebar.hidden)
|
|
61
|
+
);
|
|
62
|
+
if (pages.length === 0) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const items: RssItem[] = pages
|
|
67
|
+
.map((page) => ({
|
|
68
|
+
date: pageDate(page),
|
|
69
|
+
description: page.description,
|
|
70
|
+
link: `${base}${page.route}`,
|
|
71
|
+
title: page.title,
|
|
72
|
+
}))
|
|
73
|
+
.toSorted((a, b) => (b.date?.getTime() ?? 0) - (a.date?.getTime() ?? 0))
|
|
74
|
+
.slice(0, rss.limit);
|
|
75
|
+
|
|
76
|
+
feeds.push({
|
|
77
|
+
description: config.description,
|
|
78
|
+
items,
|
|
79
|
+
link: base,
|
|
80
|
+
path: `/${type}/rss.xml`,
|
|
81
|
+
title: `${config.title} — ${capitalize(type)}`,
|
|
82
|
+
type,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return feeds;
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const escapeXml = (value: string): string =>
|
|
89
|
+
value
|
|
90
|
+
.replaceAll("&", "&")
|
|
91
|
+
.replaceAll("<", "<")
|
|
92
|
+
.replaceAll(">", ">")
|
|
93
|
+
.replaceAll('"', """)
|
|
94
|
+
.replaceAll("'", "'");
|
|
95
|
+
|
|
96
|
+
const renderItem = (item: RssItem): string => {
|
|
97
|
+
const parts = [
|
|
98
|
+
` <title>${escapeXml(item.title)}</title>`,
|
|
99
|
+
` <link>${escapeXml(item.link)}</link>`,
|
|
100
|
+
` <guid isPermaLink="true">${escapeXml(item.link)}</guid>`,
|
|
101
|
+
];
|
|
102
|
+
if (item.description) {
|
|
103
|
+
parts.push(` <description>${escapeXml(item.description)}</description>`);
|
|
104
|
+
}
|
|
105
|
+
if (item.date) {
|
|
106
|
+
parts.push(` <pubDate>${item.date.toUTCString()}</pubDate>`);
|
|
107
|
+
}
|
|
108
|
+
return ` <item>\n${parts.join("\n")}\n </item>`;
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
/** Serialize a resolved feed into an RSS 2.0 XML document. */
|
|
112
|
+
export const renderRssFeed = (feed: RssFeed): string => {
|
|
113
|
+
const channel = [
|
|
114
|
+
` <title>${escapeXml(feed.title)}</title>`,
|
|
115
|
+
` <link>${escapeXml(feed.link)}</link>`,
|
|
116
|
+
` <description>${escapeXml(feed.description ?? feed.title)}</description>`,
|
|
117
|
+
` <atom:link href="${escapeXml(`${feed.link}${feed.path}`)}" rel="self" type="application/rss+xml" />`,
|
|
118
|
+
];
|
|
119
|
+
const items = feed.items.map(renderItem).join("\n");
|
|
120
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
121
|
+
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
|
|
122
|
+
<channel>
|
|
123
|
+
${channel.join("\n")}
|
|
124
|
+
${items}
|
|
125
|
+
</channel>
|
|
126
|
+
</rss>
|
|
127
|
+
`;
|
|
128
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { BlumeProject } from "../core/project-graph.ts";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Build a sitemap.xml from the route manifest. Returns null when the sitemap is
|
|
5
|
+
* disabled or no `site` is configured (absolute URLs are required for a valid
|
|
6
|
+
* sitemap). Drafts, hidden, and `noindex` pages are excluded.
|
|
7
|
+
*/
|
|
8
|
+
export const buildSitemap = (project: BlumeProject): string | null => {
|
|
9
|
+
const { site } = project.config.deployment;
|
|
10
|
+
if (!(site && project.config.seo.sitemap)) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const base = site.replace(/\/$/u, "");
|
|
15
|
+
const urls = project.graph.pages
|
|
16
|
+
.filter(
|
|
17
|
+
(page) =>
|
|
18
|
+
!(page.meta.draft || page.meta.sidebar.hidden || page.meta.seo.noindex)
|
|
19
|
+
)
|
|
20
|
+
.map((page) => ` <url><loc>${base}${page.route}</loc></url>`)
|
|
21
|
+
.toSorted();
|
|
22
|
+
|
|
23
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
24
|
+
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
25
|
+
${urls.join("\n")}
|
|
26
|
+
</urlset>
|
|
27
|
+
`;
|
|
28
|
+
};
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export { defineConfig } from "./core/config.ts";
|
|
2
|
+
export type {
|
|
3
|
+
BlumeBanner,
|
|
4
|
+
BlumeData,
|
|
5
|
+
BlumeDataConfig,
|
|
6
|
+
BlumeDataI18n,
|
|
7
|
+
BlumeDataLocale,
|
|
8
|
+
BlumeFavicon,
|
|
9
|
+
BlumeFeed,
|
|
10
|
+
BlumeLogo,
|
|
11
|
+
BlumeRoute,
|
|
12
|
+
} from "./core/data.ts";
|
|
13
|
+
export { defineComponents } from "./core/define-components.ts";
|
|
14
|
+
export type {
|
|
15
|
+
ComponentOverride,
|
|
16
|
+
ComponentOverrides,
|
|
17
|
+
IslandDescriptor,
|
|
18
|
+
} from "./core/define-components.ts";
|
|
19
|
+
export { defineMeta } from "./core/define-meta.ts";
|
|
20
|
+
export type {
|
|
21
|
+
FolderMetaDefinition,
|
|
22
|
+
FolderMetaFactory,
|
|
23
|
+
} from "./core/define-meta.ts";
|
|
24
|
+
export type { UIStrings } from "./core/i18n-ui.ts";
|
|
25
|
+
export type {
|
|
26
|
+
BlumeConfig,
|
|
27
|
+
FolderMeta,
|
|
28
|
+
HydrationMode,
|
|
29
|
+
ResolvedConfig,
|
|
30
|
+
} from "./core/schema.ts";
|
|
31
|
+
export type {
|
|
32
|
+
Diagnostic,
|
|
33
|
+
Heading,
|
|
34
|
+
NavNode,
|
|
35
|
+
Navigation,
|
|
36
|
+
NavTab,
|
|
37
|
+
PageRecord,
|
|
38
|
+
} from "./core/types.ts";
|
|
39
|
+
export { getBlumeVersion } from "./core/version.ts";
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-fence meta. A Shiki transformer reads the tokens after the language and
|
|
3
|
+
* promotes them to attributes on the rendered `<pre>`:
|
|
4
|
+
*
|
|
5
|
+
* - a title — the first bare token (```ts blume.config.ts) or `title="..."` —
|
|
6
|
+
* becomes `data-title`; the theme's code header shows it, falling back to the
|
|
7
|
+
* language label.
|
|
8
|
+
* - the `lineNumbers` keyword (```ts file.ts lineNumbers) becomes
|
|
9
|
+
* `data-line-numbers`; the theme renders a counter-driven line-number gutter.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/** The slice of Shiki's transformer `this` context Blume reads. */
|
|
13
|
+
interface CodeMetaContext {
|
|
14
|
+
options: { meta?: { __raw?: string } };
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/** The `<pre>` hast node a Shiki `pre` hook receives. */
|
|
18
|
+
interface PreNode {
|
|
19
|
+
properties: Record<string, boolean | number | string | undefined>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/** A Shiki-compatible transformer, typed structurally to avoid a Shiki dep. */
|
|
23
|
+
export interface CodeTitleTransformer {
|
|
24
|
+
name: string;
|
|
25
|
+
pre: (this: CodeMetaContext, node: PreNode) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const TITLE_ATTR = /title=(?<quote>["'])(?<title>[^"']*)\k<quote>/u;
|
|
29
|
+
const LINE_NUMBERS = /(?:^|\s)lineNumbers(?=\s|$)/u;
|
|
30
|
+
|
|
31
|
+
const parseTitle = (raw: string | undefined): string | undefined => {
|
|
32
|
+
if (!raw) {
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
const explicit = raw.match(TITLE_ATTR);
|
|
36
|
+
if (explicit?.groups?.title) {
|
|
37
|
+
return explicit.groups.title;
|
|
38
|
+
}
|
|
39
|
+
// The first bare token is the title (```ts blume.config.ts), skipping Shiki
|
|
40
|
+
// line ranges (`{1,3-5}`), `key=value` attrs, and the reserved `lineNumbers`
|
|
41
|
+
// and `twoslash` keywords.
|
|
42
|
+
return raw
|
|
43
|
+
.trim()
|
|
44
|
+
.split(/\s+/u)
|
|
45
|
+
.find(
|
|
46
|
+
(token) =>
|
|
47
|
+
token.length > 0 &&
|
|
48
|
+
token !== "lineNumbers" &&
|
|
49
|
+
token !== "twoslash" &&
|
|
50
|
+
!token.startsWith("{") &&
|
|
51
|
+
!token.includes("=")
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const hasLineNumbers = (raw: string | undefined): boolean =>
|
|
56
|
+
Boolean(raw && LINE_NUMBERS.test(raw));
|
|
57
|
+
|
|
58
|
+
/** Build the transformer. Runs after Shiki's built-in `data-language` hook. */
|
|
59
|
+
export const codeTitleTransformer = (): CodeTitleTransformer => ({
|
|
60
|
+
name: "blume:code-meta",
|
|
61
|
+
pre(node) {
|
|
62
|
+
const raw = this.options.meta?.__raw;
|
|
63
|
+
const title = parseTitle(raw);
|
|
64
|
+
if (title) {
|
|
65
|
+
node.properties.dataTitle = title;
|
|
66
|
+
}
|
|
67
|
+
if (hasLineNumbers(raw)) {
|
|
68
|
+
node.properties.dataLineNumbers = true;
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
});
|