@stacksjs/bunpress 0.1.21 → 0.2.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.
Files changed (57) hide show
  1. package/dist/bin/cli.d.ts +3 -0
  2. package/dist/bin/cli.js +1 -1
  3. package/dist/bin/commands/doctor.d.ts +1 -0
  4. package/dist/bin/commands/seo.d.ts +19 -0
  5. package/dist/{chunk-qrp18ybj.js → chunk-desvs9bx.js} +1 -1
  6. package/dist/chunk-em1tv2bw.js +38 -0
  7. package/dist/{chunk-kxr6zf7e.js → chunk-kfbpnqaw.js} +1308 -696
  8. package/dist/chunk-qqn901qf.js +393 -0
  9. package/dist/{chunk-qdmkac4z.js → chunk-qzhr4d2q.js} +10 -11
  10. package/dist/chunk-y3z183hg.js +10 -0
  11. package/dist/chunk-yfwm5337.js +2 -0
  12. package/dist/{chunk-m0g9vk1e.js → chunk-zkdm5pr7.js} +401 -194
  13. package/dist/src/build-manifest.d.ts +22 -0
  14. package/dist/src/config.d.ts +12 -0
  15. package/dist/src/data-loader.d.ts +6 -3
  16. package/dist/src/highlighter.d.ts +2 -1
  17. package/dist/src/i18n.d.ts +67 -0
  18. package/dist/src/index.d.ts +2 -0
  19. package/dist/src/index.js +1 -1
  20. package/dist/src/markdown-fences.d.ts +37 -0
  21. package/dist/src/page-meta.d.ts +19 -0
  22. package/dist/src/search-index.d.ts +61 -0
  23. package/dist/src/serve.d.ts +20 -5
  24. package/dist/src/toc.d.ts +20 -2
  25. package/dist/src/types.d.ts +80 -8
  26. package/dist/templates/blocks/alerts/caution.stx +2 -2
  27. package/dist/templates/blocks/alerts/important.stx +2 -2
  28. package/dist/templates/blocks/alerts/note.stx +2 -2
  29. package/dist/templates/blocks/alerts/tip.stx +2 -2
  30. package/dist/templates/blocks/alerts/warning.stx +2 -2
  31. package/dist/templates/blocks/containers/danger.stx +2 -2
  32. package/dist/templates/blocks/containers/details.stx +2 -2
  33. package/dist/templates/blocks/containers/info.stx +2 -2
  34. package/dist/templates/blocks/containers/raw.stx +1 -1
  35. package/dist/templates/blocks/containers/tip.stx +2 -2
  36. package/dist/templates/blocks/containers/warning.stx +2 -2
  37. package/dist/templates/copy-page.stx +81 -0
  38. package/dist/templates/doc-footer.stx +51 -0
  39. package/dist/templates/footer.stx +45 -0
  40. package/dist/templates/hero.stx +9 -2
  41. package/dist/templates/layout-doc.stx +8 -125
  42. package/dist/templates/layout-home.stx +7 -14
  43. package/dist/templates/layout-page.stx +7 -14
  44. package/dist/templates/locale-switcher.stx +115 -0
  45. package/dist/templates/navbar.stx +49 -0
  46. package/dist/templates/page-outline.stx +149 -0
  47. package/dist/templates/page-toc.stx +1 -1
  48. package/dist/templates/search-algolia.stx +85 -0
  49. package/dist/templates/search.stx +661 -0
  50. package/dist/templates/sidebar-section.stx +44 -11
  51. package/dist/templates/sidebar.stx +11 -2
  52. package/dist/themes/vitepress/index.ts +558 -165
  53. package/package.json +16 -7
  54. package/dist/chunk-9cm3e4r4.js +0 -688
  55. package/dist/chunk-mjhqecp5.js +0 -467
  56. package/dist/chunk-wmvgjzgh.js +0 -3
  57. package/dist/chunk-zmxtnx2v.js +0 -8
@@ -0,0 +1,22 @@
1
+ declare function sha256(bytes: Uint8Array | string): string;
2
+ /**
3
+ * Describe the complete rendered tree without incorporating mtimes, traversal
4
+ * order, absolute paths, or the manifest itself. Consumers can check this file
5
+ * into evidence and compare builds made on different hosts.
6
+ */
7
+ export declare function createBuildManifest(outdir: string, generatorVersion: string, manifestPath?: string): Promise<BuildManifest>;
8
+ export declare function writeBuildManifest(outdir: string, manifestPath: string, generatorVersion: string): Promise<BuildManifest>;
9
+ /** Verify the rendered tree and report exact added, removed, or changed files. */
10
+ export declare function verifyBuildManifest(outdir: string, manifestPath: string, generatorVersion: string): Promise<BuildManifest>;
11
+ export declare interface BuildManifestEntry {
12
+ path: string
13
+ bytes: number
14
+ sha256: string
15
+ }
16
+ export declare interface BuildManifest {
17
+ schema_version: 1
18
+ generator: 'bunpress'
19
+ generator_version: string
20
+ outputs: BuildManifestEntry[]
21
+ tree_sha256: string
22
+ }
@@ -1,4 +1,16 @@
1
1
  import type { BunPressConfig } from './types';
2
+ /**
3
+ * Run the config through the plugins it declares.
4
+ *
5
+ * `ConfigPlugin` and its four hooks were a documented, typed interface that
6
+ * nothing ever called — a plugin could be written and registered and would
7
+ * simply never run. Hooks apply in declaration order so a later plugin sees
8
+ * what earlier ones produced.
9
+ *
10
+ * A plugin that throws is reported and skipped rather than taking the whole
11
+ * site down: a broken third-party plugin should not make the docs unbuildable.
12
+ */
13
+ export declare function applyConfigPlugins(loaded: BunPressConfig): BunPressConfig;
2
14
  // Backward compatibility - simple config getter
3
15
  export declare function getConfig(): Promise<BunPressConfig>;
4
16
  // Default configuration
@@ -1,7 +1,10 @@
1
1
  /**
2
- * Load all JSON data files from `<rootDir>/.data` into a single object.
3
- * Results are cached per root directory.
2
+ * Load all JSON data files into a single object.
3
+ *
4
+ * `overrideDir` comes from `config.dataDir` and is resolved against the
5
+ * working directory; without it the convention is `<rootDir>/.data`.
6
+ * Results are cached per resolved directory.
4
7
  */
5
- export declare function loadDataFiles(rootDir: string): Promise<Record<string, unknown>>;
8
+ export declare function loadDataFiles(rootDir: string, overrideDir?: string): Promise<Record<string, unknown>>;
6
9
  /** Clear the data cache (used for dev-server hot reloading). */
7
10
  export declare function clearDataCache(): void;
@@ -4,7 +4,8 @@ import type { Highlighter as TSHighlighter } from 'ts-syntax-highlighter';
4
4
  */
5
5
  export declare function resetHighlighter(): void;
6
6
  /**
7
- * Normalizes a language identifier
7
+ * Normalizes a language identifier to its canonical id.
8
+ * Unknown identifiers are returned as-is so the caller can report them.
8
9
  */
9
10
  export declare function normalizeLanguage(lang: string): string;
10
11
  /**
@@ -0,0 +1,67 @@
1
+ import type { BunPressConfig } from './types';
2
+ /** A site with no i18n block behaves exactly as it always has. */
3
+ export declare function resolveI18nConfig(config: BunPressConfig | undefined): ResolvedI18n;
4
+ /**
5
+ * Load translation files and attach a translator.
6
+ *
7
+ * `ts-i18n` is imported lazily: a site that lists no locales should not pay
8
+ * for it, and a missing install degrades to the English defaults rather than
9
+ * failing the build.
10
+ */
11
+ export declare function loadI18nTranslations(resolved: ResolvedI18n, config: BunPressConfig | undefined): Promise<ResolvedI18n>;
12
+ /**
13
+ * Split a request path into its locale and the path within that locale.
14
+ *
15
+ * The default locale lives at the root, so `/guide` is the default locale and
16
+ * `/es/guide` is Spanish. A prefix that is not a configured locale is left
17
+ * alone — otherwise a page genuinely called `/fr` would be unreachable.
18
+ */
19
+ export declare function splitLocaleFromPath(i18n: ResolvedI18n, pathname: string): { locale: string, path: string };
20
+ /** Build the public URL for a path in a given locale. */
21
+ export declare function localizeUrl(i18n: ResolvedI18n, locale: string, path: string): string;
22
+ /**
23
+ * Candidate markdown files for a path, most specific first.
24
+ *
25
+ * Both documented layouts are supported — a directory per locale
26
+ * (`docs/es/guide.md`) and a suffix per file (`docs/guide.es.md`) — because
27
+ * both appear in the guide and neither is wrong. Default-locale files come
28
+ * last so an untranslated page still renders instead of 404ing.
29
+ */
30
+ export declare function localeContentCandidates(i18n: ResolvedI18n, root: string, locale: string, path: string): string[];
31
+ /**
32
+ * Merge a locale's overrides over the site config.
33
+ *
34
+ * Shallow by design for most keys, but `themeConfig` and `markdown` are merged
35
+ * one level deeper: a locale usually overrides a single nested value (a footer
36
+ * message, a title) and a shallow merge would silently drop the rest.
37
+ */
38
+ export declare function configForLocale(config: BunPressConfig, i18n: ResolvedI18n, locale: string): BunPressConfig;
39
+ /** Display name for a locale, falling back to the code itself. */
40
+ export declare function localeLabel(i18n: ResolvedI18n, locale: string): string;
41
+ /**
42
+ * `hreflang` alternates for the current page.
43
+ *
44
+ * Search engines use these to serve the right language and to avoid treating
45
+ * translations as duplicate content, so they only mean anything with an
46
+ * absolute base URL to point at.
47
+ */
48
+ export declare function generateHreflangTags(i18n: ResolvedI18n, config: BunPressConfig, path: string): string;
49
+ /**
50
+ * Client script that sends a first-time visitor to their browser's language.
51
+ *
52
+ * Deliberately conservative: it runs only at the default locale's root, only
53
+ * once per browser, and records any manual switch so it never fights a
54
+ * reader who chose a language on purpose.
55
+ */
56
+ export declare function generateLocaleDetectionScript(i18n: ResolvedI18n): string;
57
+ export declare interface ResolvedI18n {
58
+ enabled: boolean
59
+ locales: string[]
60
+ defaultLocale: string
61
+ fallbackLocale: string | string[]
62
+ localePath: string
63
+ detectLocale: boolean
64
+ localeNames: Record<string, string>
65
+ localeConfig: Record<string, Partial<BunPressConfig>>
66
+ translate: (key: string, locale: string, params?: Record<string, string | number>) => string
67
+ }
@@ -1,11 +1,13 @@
1
1
  export * from './config';
2
2
  export * from './highlighter';
3
+ export * from './i18n';
3
4
  // export * from './plugin'
4
5
  // Named re-exports for RSS/sitemap/robots — `export *` would clash with the
5
6
  // config interfaces (e.g. RssFeedConfig) already exported from './types'.
6
7
  export { buildRssFeed, generateRssFeed } from './rss';
7
8
  export { generateRobotsTxt } from './robots';
8
9
  export { buildSitemap, generateSitemap } from './sitemap';
10
+ export { buildSearchIndex, buildSearchRuntimeConfig, SEARCH_INDEX_PATH } from './search-index';
9
11
  export * from './serve';
10
12
  export * from './toc';
11
13
  export * from './types';
package/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
2
- import{A as d,B as f,C as a,D as g,a as O,b as P,c as Q,d as S,e as T,f as V,g as W,h as X,i as Y,j as Z,k as _,l as $,m as b,n as v,o as x,p as A,q as F,r as R,s as U,t as m,u as C,v as h,w as l,x as y,y as p,z as c}from"../chunk-kxr6zf7e.js";import{L as j,M as k,N as q,O as u,P as w}from"../chunk-qdmkac4z.js";import{Q as L,R as M,S as N}from"../chunk-m0g9vk1e.js";import"../chunk-wmvgjzgh.js";export{d as wrapInLayout,c as stripConfiguredBasePath,a as startServer,g as serveCLI,O as resetHighlighter,C as processInlineTocSyntax,W as prewarmHighlighter,P as normalizeLanguage,f as markdownToHtml,Q as isLanguageSupported,T as highlightCodeSync,S as highlightCode,V as getSyntaxHighlightingStyles,X as getHighlighterInstance,p as getConfiguredBasePath,N as getConfig,_ as generateUniqueSlug,l as generateTocStyles,y as generateTocScripts,m as generateTocPositions,x as generateTocHtml,U as generateTocData,Z as generateSlug,w as generateSitemap,F as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,A as generateInlineTocHtml,R as generateFloatingTocHtml,v as filterHeadings,$ as extractHeadings,h as enhanceHeadingsWithAnchors,Y as defaultTocConfig,L as defaultConfig,M as config,b as buildTocHierarchy,u as buildSitemap,j as buildRssFeed};
2
+ import{a as W,b as X,c as Y,d as Z,e as _,f as $,g as b,h as v,i as wj,j as zj,k as Bj,l as Dj,m as Ej,n as Gj}from"../chunk-kfbpnqaw.js";import{v as j,w as k,x as q,y as u,z as w}from"../chunk-qzhr4d2q.js";import{A as Q,B as S,C as T,D as V,G as y,H as p,I as f,J as c,K as d,L as g,M as a,N as n,O as o,P as r,Q as t,R as i,S as s,T as e,U as jj,V as kj,W as qj,X as uj,Y as z,Z as B,_ as D}from"../chunk-zkdm5pr7.js";import{aa as A,ba as F,ca as R,da as U,ea as m,fa as x,ga as C,ha as l,ia as h}from"../chunk-em1tv2bw.js";export{Bj as wrapInLayout,zj as stripConfiguredBasePath,Ej as startServer,R as splitLocaleFromPath,Gj as serveCLI,A as resolveI18nConfig,W as resetHighlighter,c as reserveUniqueSlug,jj as processInlineTocSyntax,b as prewarmHighlighter,X as normalizeLanguage,Dj as markdownToHtml,p as markdownHeadingText,U as localizeUrl,C as localeLabel,m as localeContentCandidates,F as loadI18nTranslations,Y as isLanguageSupported,_ as highlightCodeSync,Z as highlightCode,$ as getSyntaxHighlightingStyles,v as getHighlighterInstance,wj as getConfiguredBasePath,V as getConfig,d as generateUniqueSlug,qj as generateTocStyles,uj as generateTocScripts,e as generateTocPositions,o as generateTocHtml,s as generateTocData,f as generateSlug,w as generateSitemap,t as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,h as generateLocaleDetectionScript,r as generateInlineTocHtml,l as generateHreflangTags,i as generateFloatingTocHtml,n as filterHeadings,g as extractHeadings,kj as enhanceHeadingsWithAnchors,y as defaultTocConfig,Q as defaultConfig,x as configForLocale,T as config,a as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Locating code regions in markdown.
3
+ *
4
+ * Every markdown extension BunPress adds — includes, code imports, containers,
5
+ * alerts, emoji, badges — is a plain-text pattern, which means a docs page that
6
+ * *demonstrates* one in a code block would otherwise have it executed instead
7
+ * of shown. This module is how the pipeline tells "code" from "prose".
8
+ */
9
+ /**
10
+ * A stateful predicate answering "is this line part of a fenced code block?",
11
+ * fence markers included. Feed it every line of a document in order.
12
+ *
13
+ * A regex pass over the whole file cannot do this: docs commonly wrap example
14
+ * markdown in a four-backtick fence containing three-backtick fences, and
15
+ * naive pairing desyncs on the first one. CommonMark's rule is that the
16
+ * closing fence uses the same character and is at least as long as the opener,
17
+ * which is what this tracks.
18
+ */
19
+ export declare function createFenceTracker(): (line: string) => boolean;
20
+ /** Remove fenced code blocks, fences included. */
21
+ export declare function stripFencedCode(markdown: string): string;
22
+ /**
23
+ * Hide fenced code blocks and inline code spans behind placeholders so a
24
+ * transform can run over prose without reaching into code examples.
25
+ *
26
+ * Restoring is a single pass: code regions are captured verbatim and can never
27
+ * themselves contain a placeholder, so there is nothing to recurse into.
28
+ */
29
+ export declare function maskCodeRegions(markdown: string): MaskedCode;
30
+ /**
31
+ * Run a transform over `markdown` with code regions hidden.
32
+ */
33
+ export declare function withCodeMasked(markdown: string, transform: (masked: string) => string | Promise<string>): Promise<string>;
34
+ export declare interface MaskedCode {
35
+ masked: string
36
+ restore: (content: string) => string
37
+ }
@@ -0,0 +1,19 @@
1
+ /** Forget cached git dates. Used by the dev server's file watcher. */
2
+ export declare function clearGitDateCache(): void;
3
+ /**
4
+ * When a source file was last changed, as an ISO string.
5
+ *
6
+ * Prefers the last commit that touched it — that is the date a reader means by
7
+ * "last updated" — and falls back to the filesystem, which is all that exists
8
+ * for an untracked or freshly written file.
9
+ */
10
+ export declare function resolveLastUpdated(docsDir: string, sourceFile: string): Promise<string | null>;
11
+ /**
12
+ * Build the edit URL for a page.
13
+ *
14
+ * `:path` is the page's path relative to the docs directory, which is what
15
+ * every forge's edit URL expects after the branch segment.
16
+ */
17
+ export declare function buildEditUrl(pattern: string, docsDir: string, sourceFile: string): string;
18
+ /** Render an ISO date for display, honouring the configured format. */
19
+ export declare function formatLastUpdated(iso: string, locale: string, options?: Intl.DateTimeFormatOptions): string;
@@ -0,0 +1,61 @@
1
+ import type { BunPressConfig, LocalSearchOptions, SearchConfig } from './types';
2
+ /**
3
+ * Merge user options over the defaults.
4
+ * Exported so the client-side runtime is configured from exactly the same
5
+ * resolution the indexer used — two copies of this logic would drift.
6
+ */
7
+ export declare function resolveSearchOptions(search: SearchConfig | undefined): typeof DEFAULT_LOCAL_SEARCH_OPTIONS;
8
+ export declare function buildSearchRuntimeConfig(config: BunPressConfig | undefined, indexUrl: string): SearchRuntimeConfig;
9
+ /**
10
+ * Walk the docs directory and build the client search index.
11
+ */
12
+ export declare function buildSearchIndex(docsDir: string, config?: BunPressConfig): Promise<SearchRecord[]>;
13
+ /** Path the client fetches the index from. */
14
+ export declare const SEARCH_INDEX_PATH: '/search-index.json';
15
+ /** Defaults for every documented local-search option. */
16
+ export declare const DEFAULT_LOCAL_SEARCH_OPTIONS: Required<
17
+ Pick<LocalSearchOptions, 'include' | 'exclude' | 'searchFields' | 'maxResults' | 'minQueryLength' | 'fuzzy' | 'fuzziness' | 'stemmer' | 'maxContentLength'>
18
+ > & { boost: Required<NonNullable<LocalSearchOptions['boost']>> };
19
+ /**
20
+ * One searchable record.
21
+ *
22
+ * The unit is a *section*, not a page: a reader searching "line numbers" wants
23
+ * to land on the heading that covers it, not at the top of a 3,000-word
24
+ * reference page and hunt. Every h2-h6 opens a new record, and the prose that
25
+ * follows it — up to the next heading — is that record's body.
26
+ */
27
+ export declare interface SearchRecord {
28
+ url: string
29
+ page: string
30
+ title: string
31
+ text: string
32
+ level: number
33
+ keywords?: string[]
34
+ locale?: string
35
+ }
36
+ /**
37
+ * Everything the browser runtime needs, derived from the same resolution the
38
+ * indexer used so ranking in the page matches how the index was built.
39
+ *
40
+ * `tokenize` and `onSearch` are user functions from a build-time config, so
41
+ * they cross to the browser as source text. That means they must not close
42
+ * over build-time values — the documented examples reference page globals,
43
+ * which is exactly what survives the trip.
44
+ */
45
+ export declare interface SearchRuntimeConfig {
46
+ indexUrl: string
47
+ placeholder: string
48
+ lazy: boolean
49
+ maxResults: number
50
+ minQueryLength: number
51
+ searchFields: string[]
52
+ boost: { title: number, headings: number, content: number }
53
+ fuzzy: boolean
54
+ fuzziness: number
55
+ stemmer: 'english' | 'none'
56
+ shortcuts: { keyboard: boolean, keys: Array<{ key: string, meta: boolean, ctrl: boolean, alt: boolean, shift: boolean }> }
57
+ result: { showDescription: boolean, descriptionLength: number, highlightMatches: boolean, showPath: boolean }
58
+ tokenizeSource: string | null
59
+ onSearchSource: string | null
60
+ locale: string | null
61
+ }
@@ -1,11 +1,9 @@
1
1
  import { config } from './config';
2
- import type { BunPressConfig } from './types';
2
+ import type { BunPressConfig, Frontmatter } from './types';
3
+ import type { ResolvedI18n } from './i18n';
3
4
  export declare function getConfiguredBasePath(config: BunPressConfig): string;
4
5
  export declare function stripConfiguredBasePath(config: BunPressConfig, pathname: string): string;
5
- /**
6
- * Wrap content in BunPress documentation layout
7
- */
8
- export declare function wrapInLayout(content: string, config: BunPressConfig, currentPath: string, layout?: string): Promise<string>;
6
+ export declare function wrapInLayout(content: string, siteConfig: BunPressConfig, currentPath: string, layout?: string, frontmatter?: Frontmatter, options?: WrapLayoutOptions): Promise<string>;
9
7
  /**
10
8
  * Convert markdown to HTML using Bun's built-in markdown parser
11
9
  * See: https://bun.com/docs/runtime/markdown
@@ -30,3 +28,20 @@ export declare function serveCLI(options?: {
30
28
  watch?: boolean
31
29
  config?: BunPressConfig
32
30
  }): Promise<void>;
31
+ /** Which code-block extras are switched on, from `features.codeBlocks`. */
32
+ export declare interface CodeBlockFeatures {
33
+ lineHighlighting: boolean
34
+ lineNumbers: boolean
35
+ diffs: boolean
36
+ errorWarningMarkers: boolean
37
+ }
38
+ /**
39
+ * Wrap content in BunPress documentation layout
40
+ */
41
+ /** Everything the layout needs about the page beyond its rendered content. */
42
+ export declare interface WrapLayoutOptions {
43
+ i18n?: ResolvedI18n
44
+ locale?: string
45
+ sourceFile?: string
46
+ docsDir?: string
47
+ }
package/dist/src/toc.d.ts CHANGED
@@ -1,8 +1,22 @@
1
1
  import type { TocConfig, TocData, TocHeading, TocPositionData } from './types';
2
+ /**
3
+ * Return the text a rendered Markdown heading exposes to the slugger.
4
+ *
5
+ * This intentionally does not reuse prose/list cleanup: a heading beginning
6
+ * with `1.` is numbered text, not an ordered-list marker.
7
+ */
8
+ export declare function markdownHeadingText(markdown: string): string;
2
9
  /**
3
10
  * Generate a URL-safe slug from heading text
4
11
  */
5
12
  export declare function generateSlug(text: string): string;
13
+ /**
14
+ * Reserve a unique heading id from an already-normalized slug.
15
+ *
16
+ * Custom anchors and generated slugs share one namespace in the rendered
17
+ * document, so callers must reserve both through the same path.
18
+ */
19
+ export declare function reserveUniqueSlug(slug: string, existingSlugs: Set<string>): string;
6
20
  /**
7
21
  * Generate unique slug for heading, handling duplicates
8
22
  */
@@ -56,9 +70,13 @@ export declare function enhanceHeadingsWithAnchors(content: string): string;
56
70
  */
57
71
  export declare function generateTocStyles(): string;
58
72
  /**
59
- * Generate JavaScript for TOC interactions
73
+ * Generate JavaScript for TOC interactions.
74
+ *
75
+ * `smoothScroll`, `activeHighlight` and `collapsible` come straight from
76
+ * TocConfig — each behaviour is emitted only when it is switched on, so a
77
+ * site that turns one off does not ship the code for it either.
60
78
  */
61
- export declare function generateTocScripts(): string;
79
+ export declare function generateTocScripts(config?: Partial<TocConfig>): string;
62
80
  /**
63
81
  * Default TOC configuration
64
82
  */
@@ -8,6 +8,8 @@ export declare interface BunPressConfig {
8
8
  nav?: NavItem[]
9
9
  siteTitle?: string
10
10
  }
11
+ search?: SearchConfig
12
+ i18n?: I18nSiteConfig
11
13
  docsDir?: string
12
14
  outDir?: string
13
15
  basePath?: string
@@ -35,7 +37,6 @@ export declare interface BunPressConfig {
35
37
  * Cloud deployment configuration
36
38
  */
37
39
  export declare interface CloudConfig {
38
- driver?: 'aws'
39
40
  region?: string
40
41
  domain?: string
41
42
  subdomain?: string
@@ -70,11 +71,12 @@ export declare interface MarkdownPluginConfig {
70
71
  title?: string
71
72
  meta?: Record<string, string>
72
73
  parserOptions?: {
73
- gfm?: boolean
74
- breaks?: boolean
75
- headerIds?: boolean
76
- headerPrefix?: string
77
- highlight?: (code: string, lang: string) => string
74
+ tables?: boolean
75
+ strikethrough?: boolean
76
+ tasklists?: boolean
77
+ autolinks?: boolean
78
+ hardBreaks?: boolean
79
+ unsafeHTML?: boolean
78
80
  }
79
81
  preserveDirectoryStructure?: boolean
80
82
  toc?: TocConfig
@@ -229,10 +231,71 @@ export declare interface TablesConfig {
229
231
  */
230
232
  export declare interface SearchConfig {
231
233
  enabled?: boolean
234
+ provider?: 'local' | 'algolia'
235
+ algolia?: AlgoliaSearchConfig
232
236
  placeholder?: string
233
237
  maxResults?: number
234
238
  keyboardShortcuts?: boolean
235
- searchFn?: (query: string, content: string[]) => SearchResult[]
239
+ shortcut?: string | string[]
240
+ lazy?: boolean
241
+ options?: LocalSearchOptions
242
+ resultOptions?: SearchResultOptions
243
+ onSearch?: (query: string, results: SearchResult[]) => void
244
+ }
245
+ /** Algolia DocSearch credentials and query parameters. */
246
+ export declare interface AlgoliaSearchConfig {
247
+ appId: string
248
+ apiKey: string
249
+ indexName: string
250
+ searchParameters?: Record<string, unknown>
251
+ placeholder?: string
252
+ }
253
+ /** Field weights used when ranking a local search hit. */
254
+ export declare interface SearchBoostConfig {
255
+ title?: number
256
+ headings?: number
257
+ content?: number
258
+ }
259
+ export declare interface LocalSearchOptions {
260
+ include?: string[]
261
+ exclude?: string[]
262
+ searchFields?: SearchField[]
263
+ maxResults?: number
264
+ minQueryLength?: number
265
+ boost?: SearchBoostConfig
266
+ tokenize?: (text: string) => string[]
267
+ fuzzy?: boolean
268
+ fuzziness?: number
269
+ stemmer?: 'english' | 'none'
270
+ storeFields?: Array<'title' | 'page' | 'text' | 'url' | 'level' | 'keywords'>
271
+ maxContentLength?: number
272
+ }
273
+ export declare interface SearchResultOptions {
274
+ showDescription?: boolean
275
+ descriptionLength?: number
276
+ highlightMatches?: boolean
277
+ showPath?: boolean
278
+ }
279
+ /**
280
+ * Per-page search control, set in frontmatter as `search:`.
281
+ * `search: false` keeps the page out of the index entirely.
282
+ */
283
+ export declare interface FrontmatterSearchConfig {
284
+ keywords?: string[]
285
+ title?: string
286
+ }
287
+ /*.{yml,json,ts}`.
288
+ */
289
+ export declare interface I18nSiteConfig {
290
+ enabled?: boolean
291
+ locales: string[]
292
+ defaultLocale?: string
293
+ fallbackLocale?: string | string[]
294
+ localePath?: string
295
+ sources?: Array<'ts' | 'yaml' | 'json'>
296
+ detectLocale?: boolean
297
+ localeConfig?: Record<string, Partial<BunPressConfig>>
298
+ localeNames?: Record<string, string>
236
299
  }
237
300
  /**
238
301
  * Search result item
@@ -273,6 +336,14 @@ export declare interface ThemeConfig {
273
336
  darkMode?: boolean | 'auto'
274
337
  cssVars?: Record<string, string>
275
338
  css?: string
339
+ editLink?: {
340
+ pattern: string
341
+ text?: string
342
+ }
343
+ lastUpdated?: boolean | {
344
+ text?: string
345
+ formatOptions?: Intl.DateTimeFormatOptions
346
+ }
276
347
  }
277
348
  /**
278
349
  * Configuration plugin interface
@@ -282,7 +353,6 @@ export declare interface ConfigPlugin {
282
353
  extendConfig?: (config: BunPressConfig) => BunPressConfig
283
354
  validateConfig?: (config: BunPressConfig) => ConfigValidationResult
284
355
  onConfigLoad?: (config: BunPressConfig) => void | Promise<void>
285
- onConfigChange?: (newConfig: BunPressConfig, oldConfig: BunPressConfig) => void | Promise<void>
286
356
  }
287
357
  /**
288
358
  * Configuration validation result
@@ -401,6 +471,8 @@ export type MarkdownPluginOptions = Partial<MarkdownPluginConfig>;
401
471
  * TOC position options
402
472
  */
403
473
  export type TocPosition = 'sidebar' | 'inline' | 'floating';
474
+ /** Which parts of a record are searched and stored. */
475
+ export type SearchField = 'title' | 'content' | 'headings' | 'keywords';
404
476
  /**
405
477
  * Sitemap change frequency values
406
478
  */
@@ -4,6 +4,6 @@
4
4
  Caution
5
5
  </p>
6
6
  <div class="github-alert-content">
7
- {!! content !!}
8
- </div>
7
+ {!! content !!}
8
+ </div>
9
9
  </div>
@@ -4,6 +4,6 @@
4
4
  Important
5
5
  </p>
6
6
  <div class="github-alert-content">
7
- {!! content !!}
8
- </div>
7
+ {!! content !!}
8
+ </div>
9
9
  </div>
@@ -4,6 +4,6 @@
4
4
  Note
5
5
  </p>
6
6
  <div class="github-alert-content">
7
- {!! content !!}
8
- </div>
7
+ {!! content !!}
8
+ </div>
9
9
  </div>
@@ -4,6 +4,6 @@
4
4
  Tip
5
5
  </p>
6
6
  <div class="github-alert-content">
7
- {!! content !!}
8
- </div>
7
+ {!! content !!}
8
+ </div>
9
9
  </div>
@@ -4,6 +4,6 @@
4
4
  Warning
5
5
  </p>
6
6
  <div class="github-alert-content">
7
- {!! content !!}
8
- </div>
7
+ {!! content !!}
8
+ </div>
9
9
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="custom-block danger">
2
2
  <p class="custom-block-title">{{title}}</p>
3
3
  <div class="custom-block-content">
4
- {!! content !!}
5
- </div>
4
+ {!! content !!}
5
+ </div>
6
6
  </div>
@@ -1,6 +1,6 @@
1
1
  <details class="custom-block details">
2
2
  <summary>{{title}}</summary>
3
3
  <div class="custom-block-content">
4
- {!! content !!}
5
- </div>
4
+ {!! content !!}
5
+ </div>
6
6
  </details>
@@ -1,6 +1,6 @@
1
1
  <div class="custom-block info">
2
2
  <p class="custom-block-title">{{title}}</p>
3
3
  <div class="custom-block-content">
4
- {!! content !!}
5
- </div>
4
+ {!! content !!}
5
+ </div>
6
6
  </div>
@@ -1,3 +1,3 @@
1
1
  <div class="bp-raw">
2
- {!! content !!}
2
+ {!! content !!}
3
3
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="custom-block tip">
2
2
  <p class="custom-block-title">{{title}}</p>
3
3
  <div class="custom-block-content">
4
- {!! content !!}
5
- </div>
4
+ {!! content !!}
5
+ </div>
6
6
  </div>
@@ -1,6 +1,6 @@
1
1
  <div class="custom-block warning">
2
2
  <p class="custom-block-title">{{title}}</p>
3
3
  <div class="custom-block-content">
4
- {!! content !!}
5
- </div>
4
+ {!! content !!}
5
+ </div>
6
6
  </div>