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.
Files changed (194) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/dist/cli/index.js +3639 -1377
  3. package/dist/cli/index.js.map +103 -91
  4. package/dist/types/ai/component-markdown.d.ts +79 -0
  5. package/dist/types/components/layout/nav-utils.d.ts +60 -0
  6. package/dist/types/core/base-path.d.ts +9 -0
  7. package/dist/types/core/config-input.d.ts +206 -4
  8. package/dist/types/core/config.d.ts +6 -4
  9. package/dist/types/core/data.d.ts +23 -1
  10. package/dist/types/core/github.d.ts +35 -0
  11. package/dist/types/core/i18n-ui.d.ts +8 -0
  12. package/dist/types/core/navigation.d.ts +69 -0
  13. package/dist/types/core/schema.d.ts +117 -1
  14. package/dist/types/core/sources/types.d.ts +31 -6
  15. package/dist/types/core/types.d.ts +23 -2
  16. package/dist/types/markdown/features.d.ts +21 -0
  17. package/dist/types/openapi/references.d.ts +21 -1
  18. package/dist/types/seo/jsonld.d.ts +105 -0
  19. package/dist/types/theme/fonts.d.ts +34 -4
  20. package/docs/_snippets/include-demo.mdx +7 -0
  21. package/docs/advanced/api-reference.mdx +3 -3
  22. package/docs/advanced/custom-pages.mdx +1 -1
  23. package/docs/advanced/graphql.mdx +84 -0
  24. package/docs/advanced/meta.ts +8 -1
  25. package/docs/configuration/ai.mdx +21 -3
  26. package/docs/configuration/index.mdx +24 -0
  27. package/docs/configuration/search.mdx +13 -1
  28. package/docs/configuration/seo.mdx +27 -0
  29. package/docs/configuration/theming.mdx +17 -0
  30. package/docs/content/components.mdx +7 -0
  31. package/docs/content/includes.mdx +68 -0
  32. package/docs/content/meta.ts +1 -0
  33. package/docs/content/navigation.mdx +25 -0
  34. package/docs/content/sources.mdx +42 -1
  35. package/docs/content/syntax.mdx +69 -1
  36. package/docs/content/versioning.mdx +15 -9
  37. package/docs/reference/cli.mdx +2 -1
  38. package/package.json +23 -14
  39. package/skills/blume-migrate/SKILL.md +16 -7
  40. package/skills/blume-migrate/references/docusaurus.md +5 -3
  41. package/skills/blume-migrate/references/fumadocs.md +10 -2
  42. package/skills/blume-migrate/references/mintlify.md +3 -2
  43. package/skills/blume-migrate/references/nextra.md +2 -2
  44. package/skills/blume-migrate/references/starlight.md +1 -1
  45. package/src/ai/agent-readability.ts +2 -1
  46. package/src/ai/ask-data.ts +2 -1
  47. package/src/ai/component-markdown.ts +199 -36
  48. package/src/ai/llms.ts +93 -6
  49. package/src/ai/markdown.ts +2 -2
  50. package/src/ai/mcp/discovery.ts +10 -2
  51. package/src/ai/mcp/server.ts +74 -2
  52. package/src/astro/generate.ts +183 -116
  53. package/src/astro/include-hmr.ts +81 -0
  54. package/src/astro/include-refresh.ts +0 -0
  55. package/src/astro/index.ts +3 -5
  56. package/src/astro/templates.ts +125 -76
  57. package/src/cli/commands/build.ts +84 -15
  58. package/src/cli/init/questions.ts +1 -0
  59. package/src/cli/init/scaffold.ts +27 -4
  60. package/src/components/colors.ts +142 -0
  61. package/src/components/content/Badge.astro +5 -12
  62. package/src/components/content/Callout.astro +19 -36
  63. package/src/components/content/Card.astro +15 -21
  64. package/src/components/content/Component.astro +10 -1
  65. package/src/components/content/GithubInfo.astro +28 -9
  66. package/src/components/content/Tabs.astro +27 -5
  67. package/src/components/content/github-info.ts +20 -5
  68. package/src/components/dropdown-dismiss.ts +122 -0
  69. package/src/components/layout/Fonts.astro +15 -8
  70. package/src/components/layout/Header.astro +44 -0
  71. package/src/components/layout/LanguageSwitcher.astro +9 -1
  72. package/src/components/layout/NavSelector.astro +12 -3
  73. package/src/components/layout/NavTree.astro +6 -18
  74. package/src/components/layout/PageActions.astro +29 -8
  75. package/src/components/layout/PageLayout.astro +10 -1
  76. package/src/components/layout/ReferenceLayout.astro +6 -1
  77. package/src/components/layout/RootLayout.astro +46 -15
  78. package/src/components/layout/Search.astro +36 -4
  79. package/src/components/layout/TableOfContents.astro +8 -2
  80. package/src/components/layout/head-scripts.ts +53 -1
  81. package/src/components/openapi/ApiOverview.astro +13 -3
  82. package/src/components/openapi/AsyncApiOperation.astro +7 -14
  83. package/src/components/openapi/GraphqlChip.astro +33 -0
  84. package/src/components/openapi/GraphqlFieldsTable.astro +111 -0
  85. package/src/components/openapi/GraphqlOperation.astro +186 -0
  86. package/src/components/openapi/GraphqlType.astro +154 -0
  87. package/src/components/openapi/MethodBadge.astro +3 -14
  88. package/src/components/openapi/Operation.astro +12 -5
  89. package/src/components/openapi/OperationPanel.astro +43 -0
  90. package/src/components/openapi/RequestPanel.astro +5 -10
  91. package/src/components/openapi/Responses.astro +1 -16
  92. package/src/components/openapi/graphql-helpers.ts +466 -0
  93. package/src/components/openapi/playground-client.ts +15 -0
  94. package/src/components/openapi/sample-panels.ts +45 -0
  95. package/src/components/openapi/snippets.ts +13 -35
  96. package/src/core/base-path.ts +11 -0
  97. package/src/core/config-input.ts +209 -2
  98. package/src/core/config.ts +6 -4
  99. package/src/core/content-assets.ts +15 -4
  100. package/src/core/data.ts +18 -2
  101. package/src/core/diagnostics.ts +8 -0
  102. package/src/core/frontmatter.ts +20 -8
  103. package/src/core/github.ts +71 -0
  104. package/src/core/graph.ts +22 -8
  105. package/src/core/heading-markers.ts +96 -0
  106. package/src/core/i18n-ui.ts +11 -0
  107. package/src/core/includes.ts +632 -0
  108. package/src/core/last-modified.ts +36 -11
  109. package/src/core/links.ts +79 -13
  110. package/src/core/meta.ts +2 -1
  111. package/src/core/nav-diagnostics.ts +11 -2
  112. package/src/core/navigation.ts +27 -6
  113. package/src/core/project-graph.ts +61 -9
  114. package/src/core/schema.ts +226 -35
  115. package/src/core/server-features.ts +5 -9
  116. package/src/core/sources/github-releases.ts +2 -2
  117. package/src/core/sources/normalize.ts +502 -115
  118. package/src/core/sources/notion.ts +43 -8
  119. package/src/core/sources/obsidian.ts +1038 -0
  120. package/src/core/sources/read.ts +36 -1
  121. package/src/core/sources/resolve.ts +34 -1
  122. package/src/core/sources/types.ts +28 -6
  123. package/src/core/sources/watch.ts +12 -8
  124. package/src/core/tsconfig-aliases.ts +48 -35
  125. package/src/core/types.ts +25 -2
  126. package/src/core/ui-packs/ar.ts +1 -0
  127. package/src/core/ui-packs/bg.ts +2 -0
  128. package/src/core/ui-packs/bn.ts +1 -0
  129. package/src/core/ui-packs/ca.ts +2 -0
  130. package/src/core/ui-packs/cs.ts +1 -0
  131. package/src/core/ui-packs/da.ts +1 -0
  132. package/src/core/ui-packs/de.ts +2 -0
  133. package/src/core/ui-packs/el.ts +2 -0
  134. package/src/core/ui-packs/es.ts +2 -0
  135. package/src/core/ui-packs/fa.ts +1 -0
  136. package/src/core/ui-packs/fi.ts +1 -0
  137. package/src/core/ui-packs/fr.ts +2 -0
  138. package/src/core/ui-packs/he.ts +1 -0
  139. package/src/core/ui-packs/hi.ts +1 -0
  140. package/src/core/ui-packs/hr.ts +2 -0
  141. package/src/core/ui-packs/hu.ts +2 -0
  142. package/src/core/ui-packs/id.ts +2 -0
  143. package/src/core/ui-packs/it.ts +1 -0
  144. package/src/core/ui-packs/ja.ts +2 -0
  145. package/src/core/ui-packs/ko.ts +2 -0
  146. package/src/core/ui-packs/nl.ts +2 -0
  147. package/src/core/ui-packs/no.ts +2 -0
  148. package/src/core/ui-packs/pl.ts +2 -0
  149. package/src/core/ui-packs/pt-br.ts +2 -0
  150. package/src/core/ui-packs/pt.ts +2 -0
  151. package/src/core/ui-packs/ro.ts +2 -0
  152. package/src/core/ui-packs/ru.ts +2 -0
  153. package/src/core/ui-packs/sk.ts +1 -0
  154. package/src/core/ui-packs/sr.ts +1 -0
  155. package/src/core/ui-packs/sv.ts +2 -0
  156. package/src/core/ui-packs/th.ts +1 -0
  157. package/src/core/ui-packs/tr.ts +2 -0
  158. package/src/core/ui-packs/uk.ts +2 -0
  159. package/src/core/ui-packs/vi.ts +1 -0
  160. package/src/core/ui-packs/zh-tw.ts +1 -0
  161. package/src/core/ui-packs/zh.ts +1 -0
  162. package/src/core/version-cut.ts +21 -3
  163. package/src/core/yaml.ts +26 -0
  164. package/src/deploy/function-bundle.ts +251 -0
  165. package/src/eval/schema.ts +3 -1
  166. package/src/markdown/code-title.ts +22 -16
  167. package/src/markdown/features.ts +21 -0
  168. package/src/markdown/fence-meta.ts +50 -0
  169. package/src/markdown/heading-anchors.ts +198 -37
  170. package/src/markdown/include.ts +247 -0
  171. package/src/markdown/index.ts +43 -34
  172. package/src/markdown/language-icon.ts +2 -2
  173. package/src/markdown/mdast.ts +7 -3
  174. package/src/markdown/ts2js.ts +264 -0
  175. package/src/openapi/asyncapi.ts +4 -1
  176. package/src/openapi/graphql-build.ts +293 -0
  177. package/src/openapi/graphql.ts +212 -0
  178. package/src/openapi/model.ts +38 -5
  179. package/src/openapi/parse.ts +34 -0
  180. package/src/openapi/proxy.ts +30 -5
  181. package/src/openapi/references.ts +89 -13
  182. package/src/openapi/render-mdx.ts +48 -8
  183. package/src/openapi/scalar.ts +5 -12
  184. package/src/openapi/source.ts +91 -23
  185. package/src/registry/eject.ts +11 -0
  186. package/src/search/documents.ts +229 -37
  187. package/src/search/orama-index.ts +9 -5
  188. package/src/seo/jsonld.ts +293 -51
  189. package/src/theme/code-block-padding.ts +16 -0
  190. package/src/theme/entry.ts +65 -11
  191. package/src/theme/fonts.ts +189 -16
  192. package/src/translate/prompts.ts +2 -0
  193. package/src/translate/run.ts +7 -0
  194. 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
+ };
@@ -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({}),