@stacksjs/bunpress 0.2.18 → 0.2.20

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/dist/src/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // @bun
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 A,j as zj,k as Bj,l as Dj,m as Ej,n as Gj,o as Hj,p as Ij}from"../chunk-d1n554nc.js";import{A as u,B as w,x as j,y as k,z as q}from"../chunk-wdrb5swv.js";import{$ as B,C as Q,D as S,E as T,F as V,I as p,J as f,K as c,L as d,M as g,N as a,O as n,P as o,Q as r,R as t,S as i,T as s,U as e,V as jj,W as kj,X as qj,Y as uj,Z as wj,_ as z,aa as D}from"../chunk-pmf08yky.js";import{da as F,ea as R,fa as U,ga as m,ha as x,ia as C,ja as l,ka as h,la as y}from"../chunk-4zrjjjjh.js";export{Ej as wrapInLayout,Dj as stripConfiguredBasePath,Hj as startServer,U as splitLocaleFromPath,X as setLanguageAliases,Ij as serveCLI,F as resolveI18nConfig,W as resetHighlighter,d as reserveUniqueSlug,kj as processInlineTocSyntax,v as prewarmHighlighter,Y as normalizeLanguage,Gj as markdownToHtml,f as markdownHeadingText,m as localizeUrl,l as localeLabel,x as localeContentCandidates,R as loadI18nTranslations,Z as isLanguageSupported,$ as highlightCodeSync,_ as highlightCode,b as getSyntaxHighlightingStyles,A as getHighlighterInstance,Bj as getConfiguredBasePath,V as getConfig,g as generateUniqueSlug,uj as generateTocStyles,wj as generateTocScripts,jj as generateTocPositions,r as generateTocHtml,e as generateTocData,c as generateSlug,w as generateSitemap,i as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,y as generateLocaleDetectionScript,t as generateInlineTocHtml,h as generateHreflangTags,s as generateFloatingTocHtml,o as filterHeadings,a as extractHeadings,qj as enhanceHeadingsWithAnchors,p as defaultTocConfig,Q as defaultConfig,zj as decodeHtmlEntities,C as configForLocale,T as config,n as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
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 A,j as zj,k as Bj,l as Dj,m as Ej,n as Gj,o as Hj,p as Ij}from"../chunk-0y87yvqf.js";import{A as u,B as w,x as j,y as k,z as q}from"../chunk-rcr6k1et.js";import{$ as wj,C as Q,D as S,E as T,F as V,K as p,L as f,M as c,N as d,O as g,P as a,Q as n,R as o,S as r,T as t,U as i,V as s,W as e,X as jj,Y as kj,Z as qj,_ as uj,aa as z,ba as B,ca as D}from"../chunk-3ymfys00.js";import{fa as F,ga as R,ha as U,ia as m,ja as x,ka as C,la as l,ma as h,na as y}from"../chunk-rnzqf7rp.js";export{Ej as wrapInLayout,Dj as stripConfiguredBasePath,Hj as startServer,U as splitLocaleFromPath,X as setLanguageAliases,Ij as serveCLI,F as resolveI18nConfig,W as resetHighlighter,d as reserveUniqueSlug,kj as processInlineTocSyntax,v as prewarmHighlighter,Y as normalizeLanguage,Gj as markdownToHtml,f as markdownHeadingText,m as localizeUrl,l as localeLabel,x as localeContentCandidates,R as loadI18nTranslations,Z as isLanguageSupported,$ as highlightCodeSync,_ as highlightCode,b as getSyntaxHighlightingStyles,A as getHighlighterInstance,Bj as getConfiguredBasePath,V as getConfig,g as generateUniqueSlug,uj as generateTocStyles,wj as generateTocScripts,jj as generateTocPositions,r as generateTocHtml,e as generateTocData,c as generateSlug,w as generateSitemap,i as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,y as generateLocaleDetectionScript,t as generateInlineTocHtml,h as generateHreflangTags,s as generateFloatingTocHtml,o as filterHeadings,a as extractHeadings,qj as enhanceHeadingsWithAnchors,p as defaultTocConfig,Q as defaultConfig,zj as decodeHtmlEntities,C as configForLocale,T as config,n 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,60 @@
1
+ export declare function isMessagePreviewLang(lang: string): boolean;
2
+ /**
3
+ * Split a fence into headers and body. Headers exist only when a `---` line
4
+ * follows lines that all read `key: value`, so a body that merely contains a
5
+ * colon is never mistaken for one.
6
+ */
7
+ export declare function parseMessage(source: string, splitParts: boolean): ParsedMessage;
8
+ export declare function renderEmailPreview(source: string): string;
9
+ /** How many SMS segments a message costs, the way carriers count them. */
10
+ export declare function countSmsSegments(text: string): SmsSegments;
11
+ export declare function renderSmsPreview(source: string): string;
12
+ /** Render a message fence, or `null` when the language is not one of ours. */
13
+ export declare function renderMessagePreview(lang: string, source: string): string | null;
14
+ /**
15
+ * Replace each top-level ```email / ```sms fence with its text, so the copy of
16
+ * a message stays searchable while every other code block is stripped from
17
+ * the search index. A message fence shown inside a longer example fence is
18
+ * left alone: that is syntax being demonstrated, not a message.
19
+ */
20
+ export declare function unwrapMessageFences(markdown: string): string;
21
+ /**
22
+ * Message previews: ```email and ```sms fences rendered as the message itself.
23
+ *
24
+ * Product docs often need to show the exact copy a system sends — a welcome
25
+ * email, a class reminder text — and a plain code block reads as code, not as
26
+ * a message. These fences render an email as a mail-client card (headers,
27
+ * subject, body, buttons) and an SMS thread as phone bubbles with a character
28
+ * and segment count, so a reader sees what the recipient sees.
29
+ *
30
+ * ````md
31
+ * ```email
32
+ * from: Acme <hello@acme.com>
33
+ * to: The new member
34
+ * subject: Welcome to Acme, {firstName}
35
+ * ---
36
+ * Hi {firstName},
37
+ *
38
+ * [Set your password](https://acme.com/reset)
39
+ * ```
40
+ * ````
41
+ *
42
+ * Header lines (`key: value`) come before the first `---`; the body follows.
43
+ * In an `sms` fence every later `---` starts another message in the thread,
44
+ * and a message whose lines all start with `> ` is a reply from the recipient.
45
+ * In an `email` fence a later `---` is a divider (above a footer, say).
46
+ * `{name}` and `{{ name }}` placeholders are highlighted as variables.
47
+ */
48
+ /** The fence languages rendered as message previews. */
49
+ export declare const MESSAGE_PREVIEW_LANGS: readonly string[];
50
+ /** Styles for both previews, built on the theme's own colour variables. */
51
+ export declare const messagePreviewCSS: string;
52
+ export declare interface ParsedMessage {
53
+ headers: Array<{ key: string, value: string }>
54
+ parts: string[][]
55
+ }
56
+ export declare interface SmsSegments {
57
+ encoding: 'GSM-7' | 'UCS-2'
58
+ length: number
59
+ segments: number
60
+ }
@@ -40,6 +40,7 @@ export declare interface CodeBlockFeatures {
40
40
  lineNumbers: boolean
41
41
  diffs: boolean
42
42
  errorWarningMarkers: boolean
43
+ messagePreviews?: boolean
43
44
  }
44
45
  /**
45
46
  * Wrap content in BunPress documentation layout
@@ -8,4 +8,8 @@ export declare function clearComponentCache(): void;
8
8
  * @param context Variables available to bound props and components.
9
9
  * @param depth Internal recursion guard for components emitting components.
10
10
  */
11
- export declare function resolveStxComponents(content: string, componentsDir: string, context: Record<string, unknown>, depth?: number): Promise<string>;
11
+ export declare function resolveStxComponents(content: string, componentsDir: string, context: Record<string, unknown>, options?: ComponentRenderOptions, depth?: number): Promise<string>;
12
+ export declare interface ComponentRenderOptions {
13
+ fallbackComponentsDir?: string
14
+ rendered?: Map<string, string>
15
+ }
@@ -17,6 +17,7 @@ export declare interface BunPressConfig {
17
17
  outDir?: string
18
18
  basePath?: string
19
19
  componentsDir?: string
20
+ fallbackComponentsDir?: string
20
21
  dataDir?: string
21
22
  fonts?: {
22
23
  google?: string[]
@@ -217,6 +218,7 @@ export declare interface MarkdownFeaturesConfig {
217
218
  githubAlerts?: boolean | GitHubAlertsConfig
218
219
  codeBlocks?: boolean | CodeBlocksConfig
219
220
  codeGroups?: boolean
221
+ messagePreviews?: boolean
220
222
  codeImports?: boolean
221
223
  inlineToc?: boolean
222
224
  customAnchors?: boolean
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stacksjs/bunpress",
3
3
  "type": "module",
4
- "version": "0.2.18",
4
+ "version": "0.2.20",
5
5
  "description": "Modern documentation engine. Powered by Bun.",
6
6
  "author": "Chris Breuer <chris@stacksjs.org>",
7
7
  "license": "MIT",