blume 1.5.2 → 1.6.0
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/CHANGELOG.md +85 -0
- package/dist/cli/index.js +3639 -1377
- package/dist/cli/index.js.map +103 -91
- package/dist/types/ai/component-markdown.d.ts +79 -0
- package/dist/types/components/layout/nav-utils.d.ts +60 -0
- package/dist/types/core/base-path.d.ts +9 -0
- package/dist/types/core/config-input.d.ts +206 -4
- package/dist/types/core/config.d.ts +6 -4
- package/dist/types/core/data.d.ts +23 -1
- package/dist/types/core/github.d.ts +35 -0
- package/dist/types/core/i18n-ui.d.ts +8 -0
- package/dist/types/core/navigation.d.ts +69 -0
- package/dist/types/core/schema.d.ts +117 -1
- package/dist/types/core/sources/types.d.ts +31 -6
- package/dist/types/core/types.d.ts +23 -2
- package/dist/types/markdown/features.d.ts +21 -0
- package/dist/types/openapi/references.d.ts +21 -1
- package/dist/types/seo/jsonld.d.ts +105 -0
- package/dist/types/theme/fonts.d.ts +34 -4
- package/docs/_snippets/include-demo.mdx +7 -0
- package/docs/advanced/api-reference.mdx +3 -3
- package/docs/advanced/custom-pages.mdx +1 -1
- package/docs/advanced/graphql.mdx +84 -0
- package/docs/advanced/meta.ts +8 -1
- package/docs/configuration/ai.mdx +21 -3
- package/docs/configuration/index.mdx +24 -0
- package/docs/configuration/search.mdx +13 -1
- package/docs/configuration/seo.mdx +27 -0
- package/docs/configuration/theming.mdx +17 -0
- package/docs/content/components.mdx +7 -0
- package/docs/content/includes.mdx +68 -0
- package/docs/content/meta.ts +1 -0
- package/docs/content/navigation.mdx +25 -0
- package/docs/content/sources.mdx +42 -1
- package/docs/content/syntax.mdx +69 -1
- package/docs/content/versioning.mdx +15 -9
- package/docs/reference/cli.mdx +2 -1
- package/package.json +23 -14
- package/skills/blume-migrate/SKILL.md +16 -7
- package/skills/blume-migrate/references/docusaurus.md +5 -3
- package/skills/blume-migrate/references/fumadocs.md +10 -2
- package/skills/blume-migrate/references/mintlify.md +3 -2
- package/skills/blume-migrate/references/nextra.md +2 -2
- package/skills/blume-migrate/references/starlight.md +1 -1
- package/src/ai/agent-readability.ts +2 -1
- package/src/ai/ask-data.ts +2 -1
- package/src/ai/component-markdown.ts +199 -36
- package/src/ai/llms.ts +93 -6
- package/src/ai/markdown.ts +2 -2
- package/src/ai/mcp/discovery.ts +10 -2
- package/src/ai/mcp/server.ts +74 -2
- package/src/astro/generate.ts +183 -116
- package/src/astro/include-hmr.ts +81 -0
- package/src/astro/include-refresh.ts +0 -0
- package/src/astro/index.ts +3 -5
- package/src/astro/templates.ts +125 -76
- package/src/cli/commands/build.ts +84 -15
- package/src/cli/init/questions.ts +1 -0
- package/src/cli/init/scaffold.ts +27 -4
- package/src/components/colors.ts +142 -0
- package/src/components/content/Badge.astro +5 -12
- package/src/components/content/Callout.astro +19 -36
- package/src/components/content/Card.astro +15 -21
- package/src/components/content/Component.astro +10 -1
- package/src/components/content/GithubInfo.astro +28 -9
- package/src/components/content/Tabs.astro +27 -5
- package/src/components/content/github-info.ts +20 -5
- package/src/components/dropdown-dismiss.ts +122 -0
- package/src/components/layout/Fonts.astro +15 -8
- package/src/components/layout/Header.astro +44 -0
- package/src/components/layout/LanguageSwitcher.astro +9 -1
- package/src/components/layout/NavSelector.astro +12 -3
- package/src/components/layout/NavTree.astro +6 -18
- package/src/components/layout/PageActions.astro +29 -8
- package/src/components/layout/PageLayout.astro +10 -1
- package/src/components/layout/ReferenceLayout.astro +6 -1
- package/src/components/layout/RootLayout.astro +46 -15
- package/src/components/layout/Search.astro +36 -4
- package/src/components/layout/TableOfContents.astro +8 -2
- package/src/components/layout/head-scripts.ts +53 -1
- package/src/components/openapi/ApiOverview.astro +13 -3
- package/src/components/openapi/AsyncApiOperation.astro +7 -14
- package/src/components/openapi/GraphqlChip.astro +33 -0
- package/src/components/openapi/GraphqlFieldsTable.astro +111 -0
- package/src/components/openapi/GraphqlOperation.astro +186 -0
- package/src/components/openapi/GraphqlType.astro +154 -0
- package/src/components/openapi/MethodBadge.astro +3 -14
- package/src/components/openapi/Operation.astro +12 -5
- package/src/components/openapi/OperationPanel.astro +43 -0
- package/src/components/openapi/RequestPanel.astro +5 -10
- package/src/components/openapi/Responses.astro +1 -16
- package/src/components/openapi/graphql-helpers.ts +466 -0
- package/src/components/openapi/playground-client.ts +15 -0
- package/src/components/openapi/sample-panels.ts +45 -0
- package/src/components/openapi/snippets.ts +13 -35
- package/src/core/base-path.ts +11 -0
- package/src/core/config-input.ts +209 -2
- package/src/core/config.ts +6 -4
- package/src/core/content-assets.ts +15 -4
- package/src/core/data.ts +18 -2
- package/src/core/diagnostics.ts +8 -0
- package/src/core/frontmatter.ts +20 -8
- package/src/core/github.ts +71 -0
- package/src/core/graph.ts +22 -8
- package/src/core/heading-markers.ts +96 -0
- package/src/core/i18n-ui.ts +11 -0
- package/src/core/includes.ts +632 -0
- package/src/core/last-modified.ts +36 -11
- package/src/core/links.ts +79 -13
- package/src/core/meta.ts +2 -1
- package/src/core/nav-diagnostics.ts +11 -2
- package/src/core/navigation.ts +27 -6
- package/src/core/project-graph.ts +61 -9
- package/src/core/schema.ts +226 -35
- package/src/core/server-features.ts +5 -9
- package/src/core/sources/github-releases.ts +2 -2
- package/src/core/sources/normalize.ts +502 -115
- package/src/core/sources/notion.ts +43 -8
- package/src/core/sources/obsidian.ts +1038 -0
- package/src/core/sources/read.ts +36 -1
- package/src/core/sources/resolve.ts +34 -1
- package/src/core/sources/types.ts +28 -6
- package/src/core/sources/watch.ts +12 -8
- package/src/core/tsconfig-aliases.ts +48 -35
- package/src/core/types.ts +25 -2
- package/src/core/ui-packs/ar.ts +1 -0
- package/src/core/ui-packs/bg.ts +2 -0
- package/src/core/ui-packs/bn.ts +1 -0
- package/src/core/ui-packs/ca.ts +2 -0
- package/src/core/ui-packs/cs.ts +1 -0
- package/src/core/ui-packs/da.ts +1 -0
- package/src/core/ui-packs/de.ts +2 -0
- package/src/core/ui-packs/el.ts +2 -0
- package/src/core/ui-packs/es.ts +2 -0
- package/src/core/ui-packs/fa.ts +1 -0
- package/src/core/ui-packs/fi.ts +1 -0
- package/src/core/ui-packs/fr.ts +2 -0
- package/src/core/ui-packs/he.ts +1 -0
- package/src/core/ui-packs/hi.ts +1 -0
- package/src/core/ui-packs/hr.ts +2 -0
- package/src/core/ui-packs/hu.ts +2 -0
- package/src/core/ui-packs/id.ts +2 -0
- package/src/core/ui-packs/it.ts +1 -0
- package/src/core/ui-packs/ja.ts +2 -0
- package/src/core/ui-packs/ko.ts +2 -0
- package/src/core/ui-packs/nl.ts +2 -0
- package/src/core/ui-packs/no.ts +2 -0
- package/src/core/ui-packs/pl.ts +2 -0
- package/src/core/ui-packs/pt-br.ts +2 -0
- package/src/core/ui-packs/pt.ts +2 -0
- package/src/core/ui-packs/ro.ts +2 -0
- package/src/core/ui-packs/ru.ts +2 -0
- package/src/core/ui-packs/sk.ts +1 -0
- package/src/core/ui-packs/sr.ts +1 -0
- package/src/core/ui-packs/sv.ts +2 -0
- package/src/core/ui-packs/th.ts +1 -0
- package/src/core/ui-packs/tr.ts +2 -0
- package/src/core/ui-packs/uk.ts +2 -0
- package/src/core/ui-packs/vi.ts +1 -0
- package/src/core/ui-packs/zh-tw.ts +1 -0
- package/src/core/ui-packs/zh.ts +1 -0
- package/src/core/version-cut.ts +21 -3
- package/src/core/yaml.ts +26 -0
- package/src/deploy/function-bundle.ts +251 -0
- package/src/eval/schema.ts +3 -1
- package/src/markdown/code-title.ts +22 -16
- package/src/markdown/features.ts +21 -0
- package/src/markdown/fence-meta.ts +50 -0
- package/src/markdown/heading-anchors.ts +198 -37
- package/src/markdown/include.ts +247 -0
- package/src/markdown/index.ts +43 -34
- package/src/markdown/language-icon.ts +2 -2
- package/src/markdown/mdast.ts +7 -3
- package/src/markdown/ts2js.ts +264 -0
- package/src/openapi/asyncapi.ts +4 -1
- package/src/openapi/graphql-build.ts +293 -0
- package/src/openapi/graphql.ts +212 -0
- package/src/openapi/model.ts +38 -5
- package/src/openapi/parse.ts +34 -0
- package/src/openapi/proxy.ts +30 -5
- package/src/openapi/references.ts +89 -13
- package/src/openapi/render-mdx.ts +48 -8
- package/src/openapi/scalar.ts +5 -12
- package/src/openapi/source.ts +91 -23
- package/src/registry/eject.ts +11 -0
- package/src/search/documents.ts +229 -37
- package/src/search/orama-index.ts +9 -5
- package/src/seo/jsonld.ts +293 -51
- package/src/theme/code-block-padding.ts +16 -0
- package/src/theme/entry.ts +65 -11
- package/src/theme/fonts.ts +189 -16
- package/src/translate/prompts.ts +2 -0
- package/src/translate/run.ts +7 -0
- package/src/translate/work-list.ts +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Trailing heading markers, matching Fumadocs' syntax so migrated content works
|
|
3
|
+
* verbatim: `## Heading [#custom-id]` pins the anchor id, `## Heading [!toc]`
|
|
4
|
+
* keeps the heading on the page but out of the table of contents, and
|
|
5
|
+
* `## Heading [toc]` shows it only in the table of contents. Markers chain in
|
|
6
|
+
* any order (`## Heading [toc] [#id]`). The `{#id}` pin of Pandoc, kramdown,
|
|
7
|
+
* and Markdown-based specification toolchains is accepted as an equivalent of
|
|
8
|
+
* `[#id]` — in `.md` verbatim, in `.mdx` only as the escape `\{#id\}` (a bare
|
|
9
|
+
* `{…}` there is a JSX expression; the scan-time scanner reports one as
|
|
10
|
+
* `BLUME_MDX_CURLY_ANCHOR`). Both pipelines resolve escapes before parsing
|
|
11
|
+
* markers, so the escaped and bare spellings reach this parser identically.
|
|
12
|
+
*
|
|
13
|
+
* Both heading pipelines share this parser — the render-time hast plugin
|
|
14
|
+
* (`markdown/heading-anchors.ts`) and the scan-time source scanner
|
|
15
|
+
* (`core/sources/normalize.ts`) — so the rendered `id`, the TOC entry, and the
|
|
16
|
+
* anchor index `blume validate` checks against always agree.
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import type GithubSlugger from "github-slugger";
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Frontmatter key carrying the slugs of `[!toc]` headings out of a render. The
|
|
23
|
+
* hast plugin pushes onto it and the generated page template reads it back via
|
|
24
|
+
* `remarkPluginFrontmatter` to filter the TOC.
|
|
25
|
+
*/
|
|
26
|
+
export const TOC_HIDDEN_KEY = "__blumeTocHidden";
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Register a pinned `[#id]` with the document slugger, the way
|
|
30
|
+
* `GithubSlugger#slug` registers the slugs it returns — so a later heading
|
|
31
|
+
* whose auto-slug collides disambiguates (`setup` → `setup-1`) instead of
|
|
32
|
+
* silently duplicating the anchor id. An id that is already taken is left
|
|
33
|
+
* untouched (the pin still uses it verbatim; duplicate pins are the author's
|
|
34
|
+
* explicit choice).
|
|
35
|
+
*/
|
|
36
|
+
export const occupySlug = (slugger: GithubSlugger, id: string): void => {
|
|
37
|
+
slugger.occurrences[id] ??= 0;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
/** One trailing marker: `[#id]`, `{#id}`, `[toc]`, or `[!toc]`. */
|
|
41
|
+
const MARKER =
|
|
42
|
+
/\s*(?:\{#(?<curlyId>[^\s}]+)\}|\[(?:#(?<id>[^\s\]]+)|(?<hide>!)?toc)\])\s*$/u;
|
|
43
|
+
|
|
44
|
+
export interface HeadingMarkers {
|
|
45
|
+
/** Author-pinned anchor id from `[#id]` or `{#id}`, used verbatim (never re-slugged). */
|
|
46
|
+
id?: string;
|
|
47
|
+
/** The heading text with every trailing marker stripped. */
|
|
48
|
+
text: string;
|
|
49
|
+
/** `[!toc]` hides the heading from the TOC; `[toc]` shows it only there. */
|
|
50
|
+
toc?: "hide" | "only";
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Split trailing markers off a heading's text. Only markers at the very end of
|
|
55
|
+
* the heading count (mid-text brackets are ordinary prose); when a marker kind
|
|
56
|
+
* repeats, the last one written wins.
|
|
57
|
+
*
|
|
58
|
+
* `isRefDefined` reports whether a link-reference definition exists for a
|
|
59
|
+
* bracket's label (`toc`, `!toc`, `#id`): a defined bracket is a CommonMark
|
|
60
|
+
* shortcut link, not a marker — the renderer sees a resolved `<a>` element
|
|
61
|
+
* there and strips nothing at or before it, so the parse stops the same way.
|
|
62
|
+
* The render-time hast plugin never passes it (resolved links are already
|
|
63
|
+
* elements by the time it runs); the raw-source scanner does.
|
|
64
|
+
*/
|
|
65
|
+
export const parseHeadingMarkers = (
|
|
66
|
+
text: string,
|
|
67
|
+
isRefDefined?: (label: string) => boolean
|
|
68
|
+
): HeadingMarkers => {
|
|
69
|
+
let remaining = text;
|
|
70
|
+
let id: string | undefined;
|
|
71
|
+
let toc: HeadingMarkers["toc"];
|
|
72
|
+
for (
|
|
73
|
+
let match = MARKER.exec(remaining);
|
|
74
|
+
match?.groups;
|
|
75
|
+
match = MARKER.exec(remaining)
|
|
76
|
+
) {
|
|
77
|
+
const explicitId = match.groups.curlyId ?? match.groups.id;
|
|
78
|
+
const label =
|
|
79
|
+
explicitId === undefined
|
|
80
|
+
? `${match.groups.hide ?? ""}toc`
|
|
81
|
+
: `#${explicitId}`;
|
|
82
|
+
// A `{#id}` is never a shortcut link, whatever the definitions say.
|
|
83
|
+
if (match.groups.curlyId === undefined && isRefDefined?.(label)) {
|
|
84
|
+
break;
|
|
85
|
+
}
|
|
86
|
+
remaining = remaining.slice(0, match.index);
|
|
87
|
+
if (explicitId === undefined) {
|
|
88
|
+
// Stripping runs right-to-left, so keeping the first capture of each
|
|
89
|
+
// kind makes the rightmost occurrence win.
|
|
90
|
+
toc ??= match.groups.hide === undefined ? "only" : "hide";
|
|
91
|
+
} else {
|
|
92
|
+
id ??= explicitId;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
return { id, text: remaining, toc };
|
|
96
|
+
};
|
package/src/core/i18n-ui.ts
CHANGED
|
@@ -31,6 +31,11 @@ const uiStringsObject = z.object({
|
|
|
31
31
|
// `{name}` is replaced with the provider's brand name at render time.
|
|
32
32
|
openIn: z.string().default("Open in {name}"),
|
|
33
33
|
openInChat: z.string().default("Open in chat"),
|
|
34
|
+
// The prompt handed to the chat provider; `{url}` is replaced with the
|
|
35
|
+
// page's raw-Markdown URL at load time.
|
|
36
|
+
openInChatPrompt: z
|
|
37
|
+
.string()
|
|
38
|
+
.default("Read {url} so I can ask you questions about this page."),
|
|
34
39
|
scrollToTop: z.string().default("Scroll to top"),
|
|
35
40
|
})
|
|
36
41
|
.prefault({}),
|
|
@@ -107,6 +112,12 @@ const uiStringsObject = z.object({
|
|
|
107
112
|
.string()
|
|
108
113
|
.default("We couldn't find the page you're looking for."),
|
|
109
114
|
home: z.string().default("Back to home"),
|
|
115
|
+
/** Label of the llms.txt link on the 404 page. */
|
|
116
|
+
llms: z.string().default("Docs index for AI agents (llms.txt)"),
|
|
117
|
+
/** Label of the sitemap link on the 404 page. */
|
|
118
|
+
sitemap: z.string().default("Sitemap"),
|
|
119
|
+
/** Heading over the recovery links (sections, sitemap, llms.txt). */
|
|
120
|
+
suggestions: z.string().default("Where to look next"),
|
|
110
121
|
title: z.string().default("Page not found"),
|
|
111
122
|
})
|
|
112
123
|
.prefault({}),
|