@vercel/geistdocs 1.25.1-canary.6261418 → 1.25.1-canary.6c2bd30
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/cli/index.js +1 -1
- package/dist/components/image.d.ts +19 -0
- package/dist/components/image.d.ts.map +1 -0
- package/dist/components/image.js +9 -0
- package/dist/internal/chat/message.d.ts.map +1 -1
- package/dist/internal/chat/message.js +9 -7
- package/dist/internal/chat/sources.d.ts +1 -1
- package/dist/internal/chat/sources.d.ts.map +1 -1
- package/dist/internal/chat/sources.js +6 -3
- package/dist/internal/link-href.d.ts +13 -0
- package/dist/internal/link-href.d.ts.map +1 -0
- package/dist/internal/link-href.js +51 -0
- package/dist/internal/mdx-to-markdown.d.ts +3 -0
- package/dist/internal/mdx-to-markdown.d.ts.map +1 -0
- package/dist/internal/mdx-to-markdown.js +134 -0
- package/dist/mdx.d.ts.map +1 -1
- package/dist/mdx.js +2 -0
- package/dist/pages/docs.d.ts.map +1 -1
- package/dist/pages/docs.js +10 -5
- package/dist/routes/llms.d.ts +1 -1
- package/dist/routes/llms.d.ts.map +1 -1
- package/dist/routes/llms.js +12 -2
- package/dist/source.d.ts +10 -1
- package/dist/source.d.ts.map +1 -1
- package/dist/source.js +75 -34
- package/docs/agents.md +1 -1
- package/docs/llms.txt +63 -6
- package/docs/manifest.json +1 -1
- package/docs/pages/md.md +24 -5
- package/docs/pages/syntax.md +38 -0
- package/package.json +6 -1
- package/template/content/docs/md.mdx +24 -5
- package/template/content/docs/syntax.mdx +38 -0
- package/template/next.config.ts +9 -0
- package/template/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import{program as T}from"commander";import{access as ce,copyFile as le}from"fs/promises";import{join as pe}from"path";import{cancel as de,intro as ge,isCancel as ue,log as fe,outro as me,spinner as he,text as we}from"@clack/prompts";import{spawn as te}from"child_process";import{readFileSync as se}from"fs";import{cp as ne,readFile as ae,rename as re,writeFile as ie}from"fs/promises";import{join as $}from"path";import{fileURLToPath as oe}from"url";var g="@vercel/geistdocs",m=(e,t=[],s={})=>new Promise((n,a)=>{let r=te(e,t,{stdio:"inherit",...s});r.on("error",a),r.on("close",i=>{if(i===0){n();return}a(new Error(`Command failed with exit code ${i}: ${[e,...t].join(" ")}`))})}),A=["dependencies","devDependencies","optionalDependencies","peerDependencies"],_=()=>JSON.parse(se(new URL("../../package.json",import.meta.url),"utf8")).version,P=async e=>{let t=$(e,"package.json"),s=await ae(t,"utf8");return JSON.parse(s)},x=async(e,t)=>{let s=$(e,"package.json");await ie(s,`${JSON.stringify(t,null,2)}
|
|
3
|
-
`,"utf8")},R=(e,t)=>{for(let s of A){let n=e[s];if(n&&t in n)return n[t]}},V=(e,t)=>!!R(e,t),b=(e,t,s)=>{let n=!1;for(let a of A){let r=e[a];r&&t in r&&(r[t]=s,n=!0)}return n},j=()=>oe(new URL("../../template",import.meta.url)),F=async e=>{await ne(j(),e,{recursive:!0});let t=$(e,".gitignore"),s=$(e,"_gitignore");try{await re(s,t)}catch{}};var ye=async e=>{await F(e)},Pe=async e=>{try{return await ce(e),!0}catch{return!1}},ve=async()=>{await Pe(".env.example")&&await le(".env.example",".env.local")},Te=async e=>{let t=await P(e),s=_();return b(t,g,s)?(await x(e,t),!0):!1},ke=async e=>{await m("pnpm",["install"],{cwd:e,env:process.env,stdio:"inherit"})},$e=async e=>{await m("git",["init"],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["add","."],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["commit","-m","\u2728 Initial commit"],{cwd:e,env:process.env,stdio:"inherit"})},xe=async()=>{let e=await we({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return ue(e)&&(de("Operation cancelled."),process.exit(0)),e.toString()},G=async e=>{try{ge("Let's start a Geistdocs project!");let t=process.cwd(),s=e.name||await xe(),n=he(),a=pe(t,s);n.start("Copying bundled template..."),await ye(s),n.message("Setting up environment variables..."),process.chdir(a),await ve(),n.message("Rewriting package dependency versions..."),await Te(a),n.message("Installing dependencies..."),await ke(a),e.disableGit||(n.message("Initializing Git repository..."),await $e(a)),n.stop("Project initialized successfully!"),me("Run `pnpm dev` to start the development server.")}catch(t){let s=t instanceof Error?t.message:`Failed to initialize project: ${t}`;fe.error(s),process.exit(1)}};import{readFileSync as be,writeFileSync as Fe}from"fs";import{mkdir as De,readFile as N,writeFile as Se}from"fs/promises";import{dirname as Ce,extname as Re,relative as M,resolve as S}from"path";import{intro as je,isCancel as Ee,log as h,multiselect as Ne,outro as D,spinner as Ue}from"@clack/prompts";import{glob as Oe}from"glob";import{Node as v,Project as Ie,SyntaxKind as Je}from"ts-morph";var Le="geistdocs.tsx",Ae="content/docs/**/*.mdx",U=".translation-cache.json",E=8,B=()=>({version:1,entries:{}}),_e=async e=>{let t=await N(e),{createHash:s}=await import("crypto");return s("sha256").update(t).digest("hex")},Ve=e=>{let t=S(process.cwd(),e);return be(t,"utf8")},z=e=>v.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(v.isPropertyAssignment(t)){let s=t.getNameNode();if(v.isIdentifier(s)||v.isStringLiteral(s))return[s.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],Ge=e=>{try{let t=new Ie({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),s=Ve(e),r=t.createSourceFile(e,s,{overwrite:!0}).getVariableDeclarations().find(l=>l.getName()==="translations")?.getInitializer();if(!r)return[];if(v.isObjectLiteralExpression(r))return z(r);let i=r.getFirstDescendantByKind(Je.ObjectLiteralExpression);return i?z(i):[]}catch(t){let s=t instanceof Error?t.message:`${t}`;return h.warn(`Failed to read locales from ${e}: ${s}`),[]}},Be=async()=>{let e=await Ne({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ee(e)&&(D("Translation cancelled"),process.exit(0)),e},ze=async e=>(await Oe(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),He=async()=>{let e=S(process.cwd(),U);try{let t=await N(e,"utf8"),s=JSON.parse(t);return s.version!==1||!s.entries?B():{version:1,entries:s.entries}}catch{return B()}},H=e=>{let t=S(process.cwd(),U),s=JSON.stringify(e,null,2);Fe(t,s,"utf8")},Me=async e=>{let t=await Promise.all(e.map(async s=>[s,await _e(s)]));return Object.fromEntries(t)},Ke=(e,t)=>{let s=Re(e);return`${e.slice(0,-s.length)}.${t}${s}`},K=(e,t)=>`${M(process.cwd(),e)}::${t}`,qe=(e,t,s,n,a=!1)=>{let r=[],i=0;for(let l of t){let c=s[l];for(let o of e){let d=Ke(l,o),u=K(l,o),f=n.entries[u];if(!a&&f?.hash===c){i+=1;continue}r.push({locale:o,sourceFile:l,sourceHash:c,targetFile:d})}}return{tasks:r,skippedCount:i}},Xe=async e=>{await De(Ce(e),{recursive:!0})},We=async(e,t,s)=>{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:s})});if(!n.ok){let r=await n.text();throw new Error(`API request failed (${n.status}): ${r}`)}let a=await n.json();if(!a.translation)throw new Error("API response did not include a translation");return a.translation},Ye=async(e,t,s)=>{let n=await N(e.sourceFile,"utf8"),a=await We(t,n,e.locale);await Xe(e.targetFile),await Se(e.targetFile,a,"utf8"),s.entries[K(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},q=async(e,t)=>{je("Translate MDX content");let s=e??Ae,n=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",a=Ge(t.config??Le),r=await ze(s);r.length===0&&(h.error(`No MDX files found matching pattern: ${s}`),D("Translation cancelled"),process.exit(1)),h.info(`Found ${r.length} MDX file(s) matching pattern`),a.length===0&&(a=await Be());let i=S(process.cwd(),U),l=await He();await H(l),h.info(`Using cache: ${i}`);let c=await Me(r),{tasks:o,skippedCount:d}=qe(a,r,c,l,t.force);if(o.length===0){h.success("All translations are up to date!"),D(`Skipped ${d} file(s) (unchanged)`);return}let u=[];for(let y=0;y<o.length;y+=E)u.push(o.slice(y,y+E));h.info(`Processing ${o.length} translation(s) in ${u.length} batch(es) of up to ${E}`),d>0&&h.info(`Skipped ${d} translation(s) (unchanged)`);let f=Ue();f.start("Translating content...");let k=0;for(let y of u)await Promise.all(y.map(async L=>{await Ye(L,n,l),k+=1,f.message(`Translated ${k}/${o.length}: ${M(process.cwd(),L.targetFile)}`)})),await H(l);f.stop("Translation complete!"),D(`Created/updated ${o.length} file(s)`)};import{access as Ze,copyFile as Qe,mkdir as Z,rm as J}from"fs/promises";import{dirname as et,join as w}from"path";import{intro as tt,log as p,outro as C,spinner as Q}from"@clack/prompts";import{glob as st}from"glob";var nt=["**/*"],at=["content/docs/**"],O=".geistdocs-tmp",rt=async(e,t)=>{let s=w(e,t);await J(s,{recursive:!0,force:!0}),await Z(s,{recursive:!0})},I=async e=>await J(e,{recursive:!0,force:!0}),X=async(e,t,s)=>(await st(e,{cwd:s,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),it=async e=>{try{return await Ze(e),!0}catch{return!1}},ot=async(e,t,s)=>{let n=w(t,e),a=w(s,e);return await it(n)?(await Qe(n,a),{success:!0}):{success:!1,error:`Source file not found: ${n}`}},ct=async(e,t)=>{let s=w(t,e);return await J(s,{force:!0}),{success:!0}},W=20,Y=async(e,t,s)=>{let n=[];for(let a=0;a<e.length;a+=s){let r=e.slice(a,a+s),i=await Promise.all(r.map(t));n.push(...i)}return n},lt=async(e,t,s,n,a)=>{let r={success:[],deleted:[],failed:[]},i=[...new Set(e.map(c=>et(w(n,c))))];a.message(`Creating ${i.length} directories...`),await Promise.all(i.map(c=>Z(c,{recursive:!0}))),a.message(`Updating ${e.length} files...`);let l=await Y(e,async c=>{let o=await ot(c,s,n);return{file:c,...o}},W);for(let{file:c,success:o,error:d}of l)o?r.success.push(c):r.failed.push({file:c,error:d??"Unknown error"});if(t.length>0){a.message(`Deleting ${t.length} files...`);let c=await Y(t,async o=>{try{return await ct(o,n),{file:o,success:!0}}catch(d){let u=d instanceof Error?d.message:`${d}`;return{file:o,success:!1,error:u}}},W);for(let o of c)o.success?r.deleted.push(o.file):r.failed.push({file:o.file,error:o.error})}return r},pt=e=>{if(e.success.length>0){p.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)p.info(` \u2713 ${t}`)}if(e.deleted.length>0){p.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)p.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){p.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:s}of e.failed)p.error(` \u2717 ${t}: ${s}`)}},dt=e=>e.includes("canary")?"canary":"latest",gt=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(g)}`);if(!t.ok)throw new Error(`Failed to resolve ${g}@${e}`);let n=(await t.json())["dist-tags"]?.[e];if(!n)throw new Error(`Could not find dist-tag ${e} for ${g}`);return n},ut=async e=>{let t=await P(e),s=R(t,g);if(!s)return{currentVersion:s,nextVersion:void 0,updated:!1};let n=dt(s),a=await gt(n);return s===a?{currentVersion:s,nextVersion:a,updateTag:n,updated:!1}:(b(t,g,a),await x(e,t),{currentVersion:s,nextVersion:a,updateTag:n,updated:!0})},ft=async(e,t,s)=>{let n=await P(e);if(!V(n,g))return!1;t&&t.length>0&&p.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),s?.sync&&p.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:a,nextVersion:r,updateTag:i,updated:l}=await ut(e);if(!l)return p.success(a?`@vercel/geistdocs is already at ${r} (${i}).`:"No package version update was needed."),C("Package-based site is already up to date."),!0;p.info(`Bumping ${g} from ${a} to ${r} (${i})`);let c=Q();return c.start("Installing updated package version..."),await m("pnpm",["install"],{cwd:e}),c.stop("Package update complete!"),C("Please review and test the upgraded package version."),!0},mt=async(e,t,s,n,a)=>{let r=w(e,O),i=Q(),l=a?.sync?r:t;i.start("Preparing template snapshot..."),a?.sync&&(await rt(e,O),await F(r)),i.message("Scanning for files...");let c=await X(s,n,l),o=[];if(a?.sync){i.message("Comparing with local files...");let u=await X(s,n,e),f=new Set(c);o=u.filter(k=>!f.has(k))}if(i.stop(`Found ${c.length} files to update`),c.length===0&&o.length===0){p.warn("No files matched the patterns. Nothing to update."),a?.sync&&await I(r),C("Update cancelled.");return}p.info(`Patterns: ${s.length}`),p.info(`Files to update: ${c.length}`),a?.sync&&p.info(`Files to delete: ${o.length}`),i.start("Updating files...");let d=await lt(c,o,l,e,i);a?.sync&&(i.message("Cleaning up..."),await I(r)),i.stop("Update complete!"),pt(d),C("Please review and test the changes carefully.")},ee=async(e,t)=>{let s=process.cwd(),n=j(),a=e&&e.length>0?e:nt,r=e&&e.length>0?[]:at;try{if(tt("Let's update your Geistdocs project!"),await ft(s,e,t))return;p.info("Template source: bundled package snapshot"),e&&e.length>0&&p.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&p.info("Sync mode enabled: will delete files removed from template"),await mt(s,n,a,r,t)}catch(i){let l=i instanceof Error?i.message:`${i}`;try{await I(w(s,O))}catch{}p.error(`Failed to update project: ${l}`),process.exit(1)}};T.name("geistdocs").description("CLI for Geistdocs projects").version("1.25.1-canary.6261418","-v, --version","Output the current version");T.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(G);T.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(ee);T.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(q);T.parse(process.argv);
|
|
3
|
+
`,"utf8")},R=(e,t)=>{for(let s of A){let n=e[s];if(n&&t in n)return n[t]}},V=(e,t)=>!!R(e,t),b=(e,t,s)=>{let n=!1;for(let a of A){let r=e[a];r&&t in r&&(r[t]=s,n=!0)}return n},j=()=>oe(new URL("../../template",import.meta.url)),F=async e=>{await ne(j(),e,{recursive:!0});let t=$(e,".gitignore"),s=$(e,"_gitignore");try{await re(s,t)}catch{}};var ye=async e=>{await F(e)},Pe=async e=>{try{return await ce(e),!0}catch{return!1}},ve=async()=>{await Pe(".env.example")&&await le(".env.example",".env.local")},Te=async e=>{let t=await P(e),s=_();return b(t,g,s)?(await x(e,t),!0):!1},ke=async e=>{await m("pnpm",["install"],{cwd:e,env:process.env,stdio:"inherit"})},$e=async e=>{await m("git",["init"],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["add","."],{cwd:e,env:process.env,stdio:"inherit"}),await m("git",["commit","-m","\u2728 Initial commit"],{cwd:e,env:process.env,stdio:"inherit"})},xe=async()=>{let e=await we({message:"What is your project named?",placeholder:"my-app",validate(t){if(t.length===0)return"Please enter a project name."}});return ue(e)&&(de("Operation cancelled."),process.exit(0)),e.toString()},G=async e=>{try{ge("Let's start a Geistdocs project!");let t=process.cwd(),s=e.name||await xe(),n=he(),a=pe(t,s);n.start("Copying bundled template..."),await ye(s),n.message("Setting up environment variables..."),process.chdir(a),await ve(),n.message("Rewriting package dependency versions..."),await Te(a),n.message("Installing dependencies..."),await ke(a),e.disableGit||(n.message("Initializing Git repository..."),await $e(a)),n.stop("Project initialized successfully!"),me("Run `pnpm dev` to start the development server.")}catch(t){let s=t instanceof Error?t.message:`Failed to initialize project: ${t}`;fe.error(s),process.exit(1)}};import{readFileSync as be,writeFileSync as Fe}from"fs";import{mkdir as De,readFile as N,writeFile as Se}from"fs/promises";import{dirname as Ce,extname as Re,relative as M,resolve as S}from"path";import{intro as je,isCancel as Ee,log as h,multiselect as Ne,outro as D,spinner as Ue}from"@clack/prompts";import{glob as Oe}from"glob";import{Node as v,Project as Ie,SyntaxKind as Je}from"ts-morph";var Le="geistdocs.tsx",Ae="content/docs/**/*.mdx",U=".translation-cache.json",E=8,B=()=>({version:1,entries:{}}),_e=async e=>{let t=await N(e),{createHash:s}=await import("crypto");return s("sha256").update(t).digest("hex")},Ve=e=>{let t=S(process.cwd(),e);return be(t,"utf8")},z=e=>v.isObjectLiteralExpression(e)?e.getProperties().flatMap(t=>{if(v.isPropertyAssignment(t)){let s=t.getNameNode();if(v.isIdentifier(s)||v.isStringLiteral(s))return[s.getText().replaceAll(/['"]/g,"")]}return[]}).filter(Boolean):[],Ge=e=>{try{let t=new Ie({compilerOptions:{allowJs:!0,jsx:4,module:99,target:10},skipAddingFilesFromTsConfig:!0,useInMemoryFileSystem:!0}),s=Ve(e),r=t.createSourceFile(e,s,{overwrite:!0}).getVariableDeclarations().find(l=>l.getName()==="translations")?.getInitializer();if(!r)return[];if(v.isObjectLiteralExpression(r))return z(r);let i=r.getFirstDescendantByKind(Je.ObjectLiteralExpression);return i?z(i):[]}catch(t){let s=t instanceof Error?t.message:`${t}`;return h.warn(`Failed to read locales from ${e}: ${s}`),[]}},Be=async()=>{let e=await Ne({message:"Which locales should be translated?",options:[{value:"cn",label:"Chinese (cn)"},{value:"jp",label:"Japanese (jp)"},{value:"es",label:"Spanish (es)"},{value:"fr",label:"French (fr)"},{value:"de",label:"German (de)"}],required:!0});return Ee(e)&&(D("Translation cancelled"),process.exit(0)),e},ze=async e=>(await Oe(e,{cwd:process.cwd(),absolute:!0,nodir:!0})).sort(),He=async()=>{let e=S(process.cwd(),U);try{let t=await N(e,"utf8"),s=JSON.parse(t);return s.version!==1||!s.entries?B():{version:1,entries:s.entries}}catch{return B()}},H=e=>{let t=S(process.cwd(),U),s=JSON.stringify(e,null,2);Fe(t,s,"utf8")},Me=async e=>{let t=await Promise.all(e.map(async s=>[s,await _e(s)]));return Object.fromEntries(t)},Ke=(e,t)=>{let s=Re(e);return`${e.slice(0,-s.length)}.${t}${s}`},K=(e,t)=>`${M(process.cwd(),e)}::${t}`,qe=(e,t,s,n,a=!1)=>{let r=[],i=0;for(let l of t){let c=s[l];for(let o of e){let d=Ke(l,o),u=K(l,o),f=n.entries[u];if(!a&&f?.hash===c){i+=1;continue}r.push({locale:o,sourceFile:l,sourceHash:c,targetFile:d})}}return{tasks:r,skippedCount:i}},Xe=async e=>{await De(Ce(e),{recursive:!0})},We=async(e,t,s)=>{let n=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t,locale:s})});if(!n.ok){let r=await n.text();throw new Error(`API request failed (${n.status}): ${r}`)}let a=await n.json();if(!a.translation)throw new Error("API response did not include a translation");return a.translation},Ye=async(e,t,s)=>{let n=await N(e.sourceFile,"utf8"),a=await We(t,n,e.locale);await Xe(e.targetFile),await Se(e.targetFile,a,"utf8"),s.entries[K(e.sourceFile,e.locale)]={hash:e.sourceHash,updatedAt:new Date().toISOString()}},q=async(e,t)=>{je("Translate MDX content");let s=e??Ae,n=t.url||process.env.GEISTDOCS_TRANSLATE_URL||"https://geistdocs.com/translate",a=Ge(t.config??Le),r=await ze(s);r.length===0&&(h.error(`No MDX files found matching pattern: ${s}`),D("Translation cancelled"),process.exit(1)),h.info(`Found ${r.length} MDX file(s) matching pattern`),a.length===0&&(a=await Be());let i=S(process.cwd(),U),l=await He();await H(l),h.info(`Using cache: ${i}`);let c=await Me(r),{tasks:o,skippedCount:d}=qe(a,r,c,l,t.force);if(o.length===0){h.success("All translations are up to date!"),D(`Skipped ${d} file(s) (unchanged)`);return}let u=[];for(let y=0;y<o.length;y+=E)u.push(o.slice(y,y+E));h.info(`Processing ${o.length} translation(s) in ${u.length} batch(es) of up to ${E}`),d>0&&h.info(`Skipped ${d} translation(s) (unchanged)`);let f=Ue();f.start("Translating content...");let k=0;for(let y of u)await Promise.all(y.map(async L=>{await Ye(L,n,l),k+=1,f.message(`Translated ${k}/${o.length}: ${M(process.cwd(),L.targetFile)}`)})),await H(l);f.stop("Translation complete!"),D(`Created/updated ${o.length} file(s)`)};import{access as Ze,copyFile as Qe,mkdir as Z,rm as J}from"fs/promises";import{dirname as et,join as w}from"path";import{intro as tt,log as p,outro as C,spinner as Q}from"@clack/prompts";import{glob as st}from"glob";var nt=["**/*"],at=["content/docs/**"],O=".geistdocs-tmp",rt=async(e,t)=>{let s=w(e,t);await J(s,{recursive:!0,force:!0}),await Z(s,{recursive:!0})},I=async e=>await J(e,{recursive:!0,force:!0}),X=async(e,t,s)=>(await st(e,{cwd:s,nodir:!0,dot:!0,ignore:[".git/**",...t]})).sort(),it=async e=>{try{return await Ze(e),!0}catch{return!1}},ot=async(e,t,s)=>{let n=w(t,e),a=w(s,e);return await it(n)?(await Qe(n,a),{success:!0}):{success:!1,error:`Source file not found: ${n}`}},ct=async(e,t)=>{let s=w(t,e);return await J(s,{force:!0}),{success:!0}},W=20,Y=async(e,t,s)=>{let n=[];for(let a=0;a<e.length;a+=s){let r=e.slice(a,a+s),i=await Promise.all(r.map(t));n.push(...i)}return n},lt=async(e,t,s,n,a)=>{let r={success:[],deleted:[],failed:[]},i=[...new Set(e.map(c=>et(w(n,c))))];a.message(`Creating ${i.length} directories...`),await Promise.all(i.map(c=>Z(c,{recursive:!0}))),a.message(`Updating ${e.length} files...`);let l=await Y(e,async c=>{let o=await ot(c,s,n);return{file:c,...o}},W);for(let{file:c,success:o,error:d}of l)o?r.success.push(c):r.failed.push({file:c,error:d??"Unknown error"});if(t.length>0){a.message(`Deleting ${t.length} files...`);let c=await Y(t,async o=>{try{return await ct(o,n),{file:o,success:!0}}catch(d){let u=d instanceof Error?d.message:`${d}`;return{file:o,success:!1,error:u}}},W);for(let o of c)o.success?r.deleted.push(o.file):r.failed.push({file:o.file,error:o.error})}return r},pt=e=>{if(e.success.length>0){p.success(`Successfully updated ${e.success.length} files:`);for(let t of e.success)p.info(` \u2713 ${t}`)}if(e.deleted.length>0){p.success(`Deleted ${e.deleted.length} files:`);for(let t of e.deleted)p.info(` \u{1F5D1} ${t}`)}if(e.failed.length>0){p.warn(`Failed to update ${e.failed.length} files:`);for(let{file:t,error:s}of e.failed)p.error(` \u2717 ${t}: ${s}`)}},dt=e=>e.includes("canary")?"canary":"latest",gt=async e=>{let t=await fetch(`https://registry.npmjs.org/${encodeURIComponent(g)}`);if(!t.ok)throw new Error(`Failed to resolve ${g}@${e}`);let n=(await t.json())["dist-tags"]?.[e];if(!n)throw new Error(`Could not find dist-tag ${e} for ${g}`);return n},ut=async e=>{let t=await P(e),s=R(t,g);if(!s)return{currentVersion:s,nextVersion:void 0,updated:!1};let n=dt(s),a=await gt(n);return s===a?{currentVersion:s,nextVersion:a,updateTag:n,updated:!1}:(b(t,g,a),await x(e,t),{currentVersion:s,nextVersion:a,updateTag:n,updated:!0})},ft=async(e,t,s)=>{let n=await P(e);if(!V(n,g))return!1;t&&t.length>0&&p.warn("Ignoring file patterns for a package-based site. This update will bump the package version instead."),s?.sync&&p.warn("Ignoring --sync for a package-based site. Runtime updates now come from the package version.");let{currentVersion:a,nextVersion:r,updateTag:i,updated:l}=await ut(e);if(!l)return p.success(a?`@vercel/geistdocs is already at ${r} (${i}).`:"No package version update was needed."),C("Package-based site is already up to date."),!0;p.info(`Bumping ${g} from ${a} to ${r} (${i})`);let c=Q();return c.start("Installing updated package version..."),await m("pnpm",["install"],{cwd:e}),c.stop("Package update complete!"),C("Please review and test the upgraded package version."),!0},mt=async(e,t,s,n,a)=>{let r=w(e,O),i=Q(),l=a?.sync?r:t;i.start("Preparing template snapshot..."),a?.sync&&(await rt(e,O),await F(r)),i.message("Scanning for files...");let c=await X(s,n,l),o=[];if(a?.sync){i.message("Comparing with local files...");let u=await X(s,n,e),f=new Set(c);o=u.filter(k=>!f.has(k))}if(i.stop(`Found ${c.length} files to update`),c.length===0&&o.length===0){p.warn("No files matched the patterns. Nothing to update."),a?.sync&&await I(r),C("Update cancelled.");return}p.info(`Patterns: ${s.length}`),p.info(`Files to update: ${c.length}`),a?.sync&&p.info(`Files to delete: ${o.length}`),i.start("Updating files...");let d=await lt(c,o,l,e,i);a?.sync&&(i.message("Cleaning up..."),await I(r)),i.stop("Update complete!"),pt(d),C("Please review and test the changes carefully.")},ee=async(e,t)=>{let s=process.cwd(),n=j(),a=e&&e.length>0?e:nt,r=e&&e.length>0?[]:at;try{if(tt("Let's update your Geistdocs project!"),await ft(s,e,t))return;p.info("Template source: bundled package snapshot"),e&&e.length>0&&p.info(`Updating specific files: ${e.join(", ")}`),t?.sync&&p.info("Sync mode enabled: will delete files removed from template"),await mt(s,n,a,r,t)}catch(i){let l=i instanceof Error?i.message:`${i}`;try{await I(w(s,O))}catch{}p.error(`Failed to update project: ${l}`),process.exit(1)}};T.name("geistdocs").description("CLI for Geistdocs projects").version("1.25.1-canary.6c2bd30","-v, --version","Output the current version");T.command("init").description("Initialize a new Geistdocs project").option("--name <name>","Name of the project").option("--disable-git","Disable git initialization").action(G);T.command("update [files...]").description("Update a Geistdocs project (optionally specify files/patterns to update)").option("--sync","Delete local files that no longer exist in the template").action(ee);T.command("translate [pattern]").description("Translate MDX file(s) to one or more locales (default: content/docs/**/*.mdx)").option("--config <path>","Path to config file to load locales from (defaults to geistdocs.tsx)").option("--url <url>","Custom translation API URL (defaults to GEISTDOCS_TRANSLATE_URL or https://geistdocs.com/translate)").option("--force","Force re-translation of all files, ignoring cache").action(q);T.parse(process.argv);
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ImageProps as GeistImageProps } from "@vercel/geistcn/components/image";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
type ImageSource = {
|
|
4
|
+
src: string;
|
|
5
|
+
srcDark?: never;
|
|
6
|
+
srcLight?: never;
|
|
7
|
+
} | {
|
|
8
|
+
src?: never;
|
|
9
|
+
srcDark: string;
|
|
10
|
+
srcLight: string;
|
|
11
|
+
};
|
|
12
|
+
export type ImageProps = Omit<GeistImageProps, "srcDark" | "srcLight"> & ImageSource & {
|
|
13
|
+
caption?: ReactNode;
|
|
14
|
+
figureClassName?: string;
|
|
15
|
+
};
|
|
16
|
+
/** A non-interactive documentation image with an optional caption. */
|
|
17
|
+
export declare const Image: ({ caption, className, figureClassName, src, srcDark, srcLight, ...props }: ImageProps) => import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=image.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../src/components/image.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,UAAU,IAAI,eAAe,EACnC,MAAM,kCAAkC,CAAC;AAE1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,KAAK,WAAW,GACZ;IACE,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,KAAK,CAAC;IAChB,QAAQ,CAAC,EAAE,KAAK,CAAC;CAClB,GACD;IACE,GAAG,CAAC,EAAE,KAAK,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEN,MAAM,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,GAAG,UAAU,CAAC,GACpE,WAAW,GAAG;IACZ,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEJ,sEAAsE;AACtE,eAAO,MAAM,KAAK,GAAI,2EAQnB,UAAU,4CA2BZ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Image as GeistImage, } from "@vercel/geistcn/components/image";
|
|
3
|
+
import { cn } from "@vercel/geistcn/utils";
|
|
4
|
+
/** A non-interactive documentation image with an optional caption. */
|
|
5
|
+
export const Image = ({ caption, className, figureClassName, src, srcDark, srcLight, ...props }) => {
|
|
6
|
+
const lightSource = srcLight ?? src;
|
|
7
|
+
const darkSource = srcDark ?? src;
|
|
8
|
+
return (_jsxs("figure", { className: cn("not-prose my-8 flex w-full max-w-full flex-col items-stretch justify-start gap-4", figureClassName), children: [_jsx(GeistImage, { className: cn("m-0 w-full rounded-lg border border-gray-400 bg-background-100 object-contain shadow-[var(--ds-shadow-small)]", className), srcDark: darkSource, srcLight: lightSource, ...props }), caption ? (_jsx("figcaption", { className: "mx-auto max-w-[640px] text-center text-copy-14 text-gray-900 max-[600px]:px-4", children: caption })) : null] }));
|
|
9
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/message.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAEL,UAAU,EAEX,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/message.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAE5D,OAAO,EAEL,UAAU,EAEX,MAAM,YAAY,CAAC;AAyLpB,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAC1D,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,CAAC;CAChD,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,+BAA+B,YAAY,4CASlE,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjE,eAAO,MAAM,cAAc,GAAI,mCAI5B,mBAAmB,4CAqBrB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,OAAO,UAAU,CAAC,CAAC;AAErE,eAAO,MAAM,eAAe,gEACA,oBAAoB,6CAa/C,CAAC"}
|
|
@@ -7,6 +7,8 @@ import { cn } from "@vercel/geistcn/utils";
|
|
|
7
7
|
import { IconArrowUpRightSmall } from "@vercel/geistcn-assets/icons";
|
|
8
8
|
import { memo, useState } from "react";
|
|
9
9
|
import { Streamdown, } from "streamdown";
|
|
10
|
+
import { useGeistdocsConfig } from "../config-context";
|
|
11
|
+
import { resolveLinkHref } from "../link-href";
|
|
10
12
|
const CODE_LANGUAGE_PATTERN = /language-([\w-]+)/;
|
|
11
13
|
const FILENAME_PATTERN = /filename="([^"]+)"/;
|
|
12
14
|
const LinkSafetyModal = ({ isOpen, onClose, onConfirm, url, }) => {
|
|
@@ -15,17 +17,17 @@ const LinkSafetyModal = ({ isOpen, onClose, onConfirm, url, }) => {
|
|
|
15
17
|
boxShadow: "var(--ds-shadow-modal)",
|
|
16
18
|
}, width: 448, children: [_jsxs(ModalBody, { className: "bg-background-200", padding: 24, children: [_jsxs(ModalHeader, { children: [_jsx(ModalTitle, { children: "Open external link?" }), _jsx(ModalSubtitle, { children: "You\u2019re about to visit an external website." })] }), _jsx("div", { className: "break-all rounded-md bg-gray-100 p-3 font-mono text-copy-13", children: url })] }), _jsxs(ModalActions, { children: [_jsx(ModalAction, { onClick: onClose, variant: "secondary", children: "Cancel" }), _jsx(ModalAction, { onClick: onConfirm, children: "Open link" })] })] }));
|
|
17
19
|
};
|
|
18
|
-
const ChatLink = ({ children, className, href, node: _node, ...props }) => {
|
|
20
|
+
const ChatLink = ({ children, className, href, node: _node, rel, target, ...props }) => {
|
|
19
21
|
const [isOpen, setIsOpen] = useState(false);
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
if (!external) {
|
|
23
|
-
return (_jsx("a", { className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: href, ...props, children: children }));
|
|
22
|
+
const { siteUrl } = useGeistdocsConfig();
|
|
23
|
+
const resolved = resolveLinkHref(String(href ?? ""), siteUrl);
|
|
24
|
+
if (!resolved.external) {
|
|
25
|
+
return (_jsx("a", { className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: resolved.href, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, ...props, children: children }));
|
|
24
26
|
}
|
|
25
27
|
return (_jsxs(_Fragment, { children: [_jsxs("button", { className: cn("group wrap-anywhere cursor-pointer appearance-none text-left font-normal text-gray-1000! no-underline hover:text-gray-1000! hover:opacity-100!", className), onClick: () => setIsOpen(true), type: "button", children: [_jsx("span", { className: "underline decoration-1 decoration-gray-700 underline-offset-4 group-hover:decoration-gray-1000", children: children }), _jsxs("span", { className: "whitespace-nowrap", children: ["\u00a0", _jsx("span", { className: "inline-flex -translate-y-1 align-text-bottom", children: _jsx(IconArrowUpRightSmall, { size: 16 }) })] })] }), _jsx(LinkSafetyModal, { isOpen: isOpen, onClose: () => setIsOpen(false), onConfirm: () => {
|
|
26
|
-
window.open(href, "_blank", "noreferrer");
|
|
28
|
+
window.open(resolved.href, "_blank", "noreferrer");
|
|
27
29
|
setIsOpen(false);
|
|
28
|
-
}, url: href })] }));
|
|
30
|
+
}, url: resolved.href })] }));
|
|
29
31
|
};
|
|
30
32
|
const CHAT_RESPONSE_COMPONENTS = {
|
|
31
33
|
a: ChatLink,
|
|
@@ -11,5 +11,5 @@ export declare const SourcesContent: ({ className, ...props }: SourcesContentPro
|
|
|
11
11
|
export type SourceProps = ComponentProps<"a"> & {
|
|
12
12
|
href: string;
|
|
13
13
|
};
|
|
14
|
-
export declare const Source: ({ href, title, children, ...props }: SourceProps) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const Source: ({ href, title, children, rel, target, ...props }: SourceProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
15
|
//# sourceMappingURL=sources.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/sources.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"sources.d.ts","sourceRoot":"","sources":["../../../src/internal/chat/sources.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG5C,OAAO,EAEL,kBAAkB,EAClB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,YAAY,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC;AAEjD,eAAO,MAAM,OAAO,GAAI,yBAAyB,YAAY,4CAK5D,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,GAAG;IAC5E,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,0CAK5B,mBAAmB,4CAerB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,cAAc,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAE5E,eAAO,MAAM,cAAc,GAAI,yBAG5B,mBAAmB,4CAErB,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,cAAc,CAAC,GAAG,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,eAAO,MAAM,MAAM,GAAI,kDAOpB,WAAW,4CAiBb,CAAC"}
|
|
@@ -2,11 +2,14 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { cn } from "@vercel/geistcn/utils";
|
|
4
4
|
import { IconChevronDown } from "@vercel/geistcn-assets/icons";
|
|
5
|
+
import { useGeistdocsConfig } from "../config-context";
|
|
6
|
+
import { resolveLinkHref } from "../link-href";
|
|
5
7
|
import { Collapsible, CollapsibleContent, CollapsibleTrigger, } from "../ui/collapsible";
|
|
6
8
|
export const Sources = ({ className, ...props }) => (_jsx(Collapsible, { className: cn("not-prose text-gray-600 text-xs", className), ...props }));
|
|
7
9
|
export const SourcesTrigger = ({ className, count, children, ...props }) => (_jsx(CollapsibleTrigger, { className: cn("group flex items-center rounded-md border-none bg-transparent", className), ...props, children: children ?? (_jsxs(_Fragment, { children: [_jsxs("p", { className: "font-medium", children: ["Used ", count, " sources"] }), _jsx(IconChevronDown, { className: "h-4 w-4 transition-transform duration-200 group-data-[state=open]:rotate-180" })] })) }));
|
|
8
10
|
export const SourcesContent = ({ className, ...props }) => (_jsx(CollapsibleContent, { className: cn("flex flex-col", className), ...props }));
|
|
9
|
-
export const Source = ({ href, title, children, ...props }) => {
|
|
10
|
-
const
|
|
11
|
-
|
|
11
|
+
export const Source = ({ href, title, children, rel, target, ...props }) => {
|
|
12
|
+
const { siteUrl } = useGeistdocsConfig();
|
|
13
|
+
const resolved = resolveLinkHref(href, siteUrl);
|
|
14
|
+
return (_jsx("a", { className: "inline-flex min-w-0 max-w-full items-center underline underline-offset-1", href: resolved.href, rel: resolved.external ? (rel ?? "noreferrer") : undefined, target: resolved.external ? (target ?? "_blank") : undefined, ...props, children: children ?? (_jsx("span", { className: "truncate font-medium text-gray-1000", children: title })) }));
|
|
12
15
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface ResolvedLinkHref {
|
|
2
|
+
external: boolean;
|
|
3
|
+
href: string;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Treat an absolute URL on the configured production origin as app-local.
|
|
7
|
+
* Keeping the path, query, and hash makes canonical links navigate internally
|
|
8
|
+
* on production domains and previews alike.
|
|
9
|
+
*/
|
|
10
|
+
export declare const resolveLinkHref: (href: string, siteUrl?: string) => ResolvedLinkHref;
|
|
11
|
+
/** Strip the Next.js base path before handing an href to `next/link`. */
|
|
12
|
+
export declare const stripBasePathFromHref: (href: string, basePath?: string) => string;
|
|
13
|
+
//# sourceMappingURL=link-href.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link-href.d.ts","sourceRoot":"","sources":["../../src/internal/link-href.ts"],"names":[],"mappings":"AAUA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAC1B,MAAM,MAAM,EACZ,UAAU,MAAM,KACf,gBAwBF,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,WAmBpE,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
const HTTP_URL = /^https?:\/\//;
|
|
2
|
+
const normalizeBasePath = (basePath) => {
|
|
3
|
+
if (!(basePath && basePath !== "/")) {
|
|
4
|
+
return "";
|
|
5
|
+
}
|
|
6
|
+
return `/${basePath.replace(/^\/+|\/+$/g, "")}`;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Treat an absolute URL on the configured production origin as app-local.
|
|
10
|
+
* Keeping the path, query, and hash makes canonical links navigate internally
|
|
11
|
+
* on production domains and previews alike.
|
|
12
|
+
*/
|
|
13
|
+
export const resolveLinkHref = (href, siteUrl) => {
|
|
14
|
+
if (!HTTP_URL.test(href)) {
|
|
15
|
+
return { external: false, href };
|
|
16
|
+
}
|
|
17
|
+
if (!siteUrl) {
|
|
18
|
+
return { external: true, href };
|
|
19
|
+
}
|
|
20
|
+
try {
|
|
21
|
+
const url = new URL(href);
|
|
22
|
+
const site = new URL(siteUrl);
|
|
23
|
+
if (url.origin === site.origin) {
|
|
24
|
+
return {
|
|
25
|
+
external: false,
|
|
26
|
+
href: `${url.pathname}${url.search}${url.hash}`,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch {
|
|
31
|
+
// Preserve the existing external treatment for malformed absolute URLs.
|
|
32
|
+
}
|
|
33
|
+
return { external: true, href };
|
|
34
|
+
};
|
|
35
|
+
/** Strip the Next.js base path before handing an href to `next/link`. */
|
|
36
|
+
export const stripBasePathFromHref = (href, basePath) => {
|
|
37
|
+
const prefix = normalizeBasePath(basePath);
|
|
38
|
+
if (!prefix) {
|
|
39
|
+
return href;
|
|
40
|
+
}
|
|
41
|
+
if (href === prefix) {
|
|
42
|
+
return "/";
|
|
43
|
+
}
|
|
44
|
+
if (href.startsWith(`${prefix}/`)) {
|
|
45
|
+
return href.slice(prefix.length);
|
|
46
|
+
}
|
|
47
|
+
if (href.startsWith(`${prefix}?`) || href.startsWith(`${prefix}#`)) {
|
|
48
|
+
return `/${href.slice(prefix.length)}`;
|
|
49
|
+
}
|
|
50
|
+
return href;
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mdx-to-markdown.d.ts","sourceRoot":"","sources":["../../src/internal/mdx-to-markdown.ts"],"names":[],"mappings":"AAwKA,yEAAyE;AACzE,eAAO,MAAM,aAAa,GAAU,QAAQ,MAAM,oBACF,CAAC"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
2
|
+
import remarkGfm from "remark-gfm";
|
|
3
|
+
import remarkMdx from "remark-mdx";
|
|
4
|
+
import remarkParse from "remark-parse";
|
|
5
|
+
import remarkStringify from "remark-stringify";
|
|
6
|
+
import { unified } from "unified";
|
|
7
|
+
const getAttribute = (node, name) => {
|
|
8
|
+
const attribute = node.attributes?.find((entry) => entry.type === "mdxJsxAttribute" && entry.name === name);
|
|
9
|
+
if (!attribute) {
|
|
10
|
+
return undefined;
|
|
11
|
+
}
|
|
12
|
+
if (typeof attribute.value === "string") {
|
|
13
|
+
return attribute.value;
|
|
14
|
+
}
|
|
15
|
+
const expression = attribute.value?.value?.trim();
|
|
16
|
+
if (!expression) {
|
|
17
|
+
return undefined;
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const parsed = JSON.parse(expression);
|
|
21
|
+
return typeof parsed === "string" ? parsed : undefined;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const paragraph = (value) => ({
|
|
28
|
+
children: [{ type: "text", value }],
|
|
29
|
+
type: "paragraph",
|
|
30
|
+
});
|
|
31
|
+
const OMITTED_NODE_TYPES = new Set([
|
|
32
|
+
"mdxFlowExpression",
|
|
33
|
+
"mdxTextExpression",
|
|
34
|
+
"mdxjsEsm",
|
|
35
|
+
"yaml",
|
|
36
|
+
]);
|
|
37
|
+
const OMITTED_COMPONENTS = new Set([
|
|
38
|
+
"CodeBlockTabsList",
|
|
39
|
+
"CodeBlockTabsTrigger",
|
|
40
|
+
]);
|
|
41
|
+
const imageNodes = (node) => {
|
|
42
|
+
const nodes = [];
|
|
43
|
+
const alt = getAttribute(node, "alt") ?? "";
|
|
44
|
+
const source = getAttribute(node, "srcLight") ?? getAttribute(node, "src");
|
|
45
|
+
if (source) {
|
|
46
|
+
nodes.push({
|
|
47
|
+
children: [{ alt, type: "image", url: source }],
|
|
48
|
+
type: "paragraph",
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
const caption = getAttribute(node, "caption");
|
|
52
|
+
if (caption) {
|
|
53
|
+
nodes.push(paragraph(caption));
|
|
54
|
+
}
|
|
55
|
+
return nodes;
|
|
56
|
+
};
|
|
57
|
+
const calloutNode = (node) => {
|
|
58
|
+
const title = getAttribute(node, "title");
|
|
59
|
+
const heading = title
|
|
60
|
+
? [
|
|
61
|
+
{
|
|
62
|
+
children: [
|
|
63
|
+
{
|
|
64
|
+
children: [{ type: "text", value: `${title}:` }],
|
|
65
|
+
type: "strong",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
type: "paragraph",
|
|
69
|
+
},
|
|
70
|
+
]
|
|
71
|
+
: [];
|
|
72
|
+
return {
|
|
73
|
+
children: [...heading, ...(node.children ?? [])],
|
|
74
|
+
type: "blockquote",
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
const replaceComponent = (node) => {
|
|
78
|
+
if (OMITTED_COMPONENTS.has(node.name ?? "")) {
|
|
79
|
+
return [];
|
|
80
|
+
}
|
|
81
|
+
if (node.name === "Check" || node.name === "Cross") {
|
|
82
|
+
return [{ type: "text", value: node.name === "Check" ? "✓" : "✗" }];
|
|
83
|
+
}
|
|
84
|
+
if (node.name === "Image") {
|
|
85
|
+
return imageNodes(node);
|
|
86
|
+
}
|
|
87
|
+
if (node.name === "Callout") {
|
|
88
|
+
return [calloutNode(node)];
|
|
89
|
+
}
|
|
90
|
+
const text = getAttribute(node, "text");
|
|
91
|
+
if ((node.name === "CopyPrompt" || node.name === "Prompt") && text) {
|
|
92
|
+
return [paragraph(text)];
|
|
93
|
+
}
|
|
94
|
+
// Presentation-only components (including CodeBlockTabs and CodeBlockTab)
|
|
95
|
+
// should not leak into agent-readable Markdown. Their meaningful children
|
|
96
|
+
// remain in document order, so every tab's fenced code is written out.
|
|
97
|
+
return node.children ?? [];
|
|
98
|
+
};
|
|
99
|
+
const cleanNode = (node) => {
|
|
100
|
+
if (OMITTED_NODE_TYPES.has(node.type)) {
|
|
101
|
+
return [];
|
|
102
|
+
}
|
|
103
|
+
if (node.children) {
|
|
104
|
+
node.children = node.children.flatMap(cleanNode);
|
|
105
|
+
}
|
|
106
|
+
if (node.type !== "mdxJsxFlowElement" && node.type !== "mdxJsxTextElement") {
|
|
107
|
+
return [node];
|
|
108
|
+
}
|
|
109
|
+
// Native HTML can carry meaning Markdown has no equivalent for (`details`,
|
|
110
|
+
// `summary`, media, and so on). Keep it; only component-shaped JSX is a
|
|
111
|
+
// presentation abstraction that needs flattening.
|
|
112
|
+
if (node.name && node.name === node.name.toLowerCase()) {
|
|
113
|
+
return [node];
|
|
114
|
+
}
|
|
115
|
+
return replaceComponent(node);
|
|
116
|
+
};
|
|
117
|
+
const cleanChildren = (parent) => {
|
|
118
|
+
parent.children = (parent.children ?? []).flatMap(cleanNode);
|
|
119
|
+
};
|
|
120
|
+
const cleanMdx = () => (tree) => {
|
|
121
|
+
cleanChildren(tree);
|
|
122
|
+
};
|
|
123
|
+
const processor = unified()
|
|
124
|
+
.use(remarkParse)
|
|
125
|
+
.use(remarkGfm)
|
|
126
|
+
.use(remarkMdx)
|
|
127
|
+
.use(remarkFrontmatter, ["yaml"])
|
|
128
|
+
.use(cleanMdx)
|
|
129
|
+
.use(remarkStringify, {
|
|
130
|
+
bullet: "-",
|
|
131
|
+
fences: true,
|
|
132
|
+
});
|
|
133
|
+
/** Convert authored MDX into component-free, agent-readable Markdown. */
|
|
134
|
+
export const mdxToMarkdown = async (source) => String(await processor.process(source)).trim();
|
package/dist/mdx.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"mdx.d.ts","sourceRoot":"","sources":["../src/mdx.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAuB/C,OAAO,EAGL,KAAK,4BAA4B,IAAI,mBAAmB,EAGzD,MAAM,iBAAiB,CAAC;AAEzB,eAAO,MAAM,2BAA2B,8EAAe,CAAC;AACxD,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gCAAoB,CAAC;AAC5D,eAAO,MAAM,mBAAmB;;;;;;;gCAAa,CAAC;AAC9C,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;CAAa,CAAC;AAC1C,MAAM,MAAM,4BAA4B,GAAG,mBAAmB,CAAC;AAE/D,MAAM,MAAM,sBAAsB,GAAG,aAAa,CAAC;AAEnD,eAAO,MAAM,yBAAyB,GACpC,aAAa,sBAAsB,KAClC,sBAkDD,CAAC;AAEH,eAAO,MAAM,mBAAmB,GAC9B,aAAa,sBAAsB,KAClC,sBAA+D,CAAC;AAEnE,eAAO,MAAM,2BAA2B,GACtC,GAAG,eAAe,KAAK,CAAC,sBAAsB,GAAG,SAAS,CAAC,KAC1D,sBACkD,CAAC"}
|
package/dist/mdx.js
CHANGED
|
@@ -8,6 +8,7 @@ import { CodeBlock } from "./components/code-block";
|
|
|
8
8
|
import { CodeBlockTab, CodeBlockTabs, CodeBlockTabsList, CodeBlockTabsTrigger, CompactCodeBlockTabs, } from "./components/code-block-tabs";
|
|
9
9
|
import { CopyPrompt } from "./components/copy-prompt";
|
|
10
10
|
import { Heading } from "./components/heading";
|
|
11
|
+
import { Image } from "./components/image";
|
|
11
12
|
import { Mermaid } from "./components/mermaid";
|
|
12
13
|
import { Table } from "./components/table";
|
|
13
14
|
import { Video } from "./components/video";
|
|
@@ -40,6 +41,7 @@ export const getGeistdocsMDXComponents = (components) => ({
|
|
|
40
41
|
CalloutTitle,
|
|
41
42
|
CalloutDescription,
|
|
42
43
|
CopyPrompt,
|
|
44
|
+
Image,
|
|
43
45
|
Mermaid,
|
|
44
46
|
Video,
|
|
45
47
|
...components,
|
package/dist/pages/docs.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,QAAQ,IAAI,gBAAgB,EAE7B,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtE,OAAO,EAAE,KAAK,eAAe,EAA+B,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../src/pages/docs.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,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docs.js
CHANGED
|
@@ -7,6 +7,7 @@ import { notFound } from "next/navigation";
|
|
|
7
7
|
import { getPublicPath, withBasePath } from "../config";
|
|
8
8
|
import { DocsPageErrorBoundary } from "../internal/docs-page-error-boundary";
|
|
9
9
|
import { resolveDocumentTitle } from "../internal/document-title";
|
|
10
|
+
import { resolveLinkHref, stripBasePathFromHref } from "../internal/link-href";
|
|
10
11
|
import { resolvePageMarkdownUrl as resolveInternalPageMarkdownUrl } from "../internal/markdown-url.js";
|
|
11
12
|
import { createPageActions as createInternalPageActions } from "../internal/page-actions";
|
|
12
13
|
import { GeistdocsPageActions, GeistdocsTableOfContentsActions, } from "../internal/page-actions-client";
|
|
@@ -15,10 +16,13 @@ import { getPageFooterItems, PageFooter } from "../internal/page-footer";
|
|
|
15
16
|
import { GeistdocsTableOfContents } from "../internal/table-of-contents";
|
|
16
17
|
import { createMdxComponents } from "../mdx";
|
|
17
18
|
import { getPageRobots, } from "../page-visibility";
|
|
18
|
-
const
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
|
|
19
|
+
const renderPrefetchedDocsLink = (siteUrl, basePath, { children, className, href, rel, target, ...props }) => {
|
|
20
|
+
const originalHref = String(href ?? "");
|
|
21
|
+
const resolved = resolveLinkHref(originalHref, siteUrl);
|
|
22
|
+
const linkHref = resolved.href === originalHref
|
|
23
|
+
? resolved.href
|
|
24
|
+
: stripBasePathFromHref(resolved.href, basePath);
|
|
25
|
+
return (_jsx(Link, { ...props, className: cn("font-normal text-gray-1000! underline decoration-1 decoration-gray-700 underline-offset-4 hover:text-gray-1000! hover:decoration-gray-1000 hover:opacity-100!", className), href: linkHref, prefetch: !resolved.external, rel: resolved.external ? rel : undefined, target: resolved.external ? target : undefined, children: children }));
|
|
22
26
|
};
|
|
23
27
|
export const resolvePageMarkdownUrl = (options) => resolveInternalPageMarkdownUrl(options);
|
|
24
28
|
const DocsTitle = ({ className, ...props }) => (_jsx(FumadocsDocsTitle, { className: cn("mb-4 text-balance", className), ...props }));
|
|
@@ -30,6 +34,7 @@ const hasTableOfContentsActions = (config, extraActions) => config.pageActions?.
|
|
|
30
34
|
config.feedback?.enabled !== false ||
|
|
31
35
|
extraActions.length > 0;
|
|
32
36
|
export const createDocsPage = ({ config, source, mdx, pageActions = createInternalPageActions({ config }), filterStaticParams, getMarkdownUrl, getPageUrl, getPublicPageUrl, metadata, openGraph, renderTop, resolveLink, tableOfContent, tableOfContentPopover, }) => {
|
|
37
|
+
const DocsLink = renderPrefetchedDocsLink.bind(null, config.siteUrl, config.basePath);
|
|
33
38
|
const resolvePageUrls = (page, params) => {
|
|
34
39
|
const pageUrl = getPageUrl?.({ page, params }) ?? page.url;
|
|
35
40
|
const publicPageUrl = getPublicPageUrl?.({ page, params, pageUrl }) ??
|
|
@@ -52,7 +57,7 @@ export const createDocsPage = ({ config, source, mdx, pageActions = createIntern
|
|
|
52
57
|
}
|
|
53
58
|
const data = page.data;
|
|
54
59
|
const MDX = data.body;
|
|
55
|
-
const defaultLink = createRelativeLink(source.source, page,
|
|
60
|
+
const defaultLink = createRelativeLink(source.source, page, DocsLink);
|
|
56
61
|
const link = resolveLink
|
|
57
62
|
? resolveLink({ link: defaultLink, page, source })
|
|
58
63
|
: defaultLink;
|
package/dist/routes/llms.d.ts
CHANGED
|
@@ -30,7 +30,7 @@ export declare const createLlmsRoute: ({ filterPage, source, sources, transform,
|
|
|
30
30
|
revalidate: false;
|
|
31
31
|
};
|
|
32
32
|
export interface CreateDocsMarkdownRouteOptions {
|
|
33
|
-
config?: Pick<GeistdocsConfig, "basePath" | "defaultLanguage" | "translations">;
|
|
33
|
+
config?: Pick<GeistdocsConfig, "basePath" | "defaultLanguage" | "siteUrl" | "translations">;
|
|
34
34
|
filterStaticParams?: (params: DocsMarkdownParams) => boolean;
|
|
35
35
|
/** Customize the agent-readable Markdown response for missing pages, or disable it. */
|
|
36
36
|
notFound?: false | MarkdownNotFoundOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"llms.d.ts","sourceRoot":"","sources":["../../src/routes/llms.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"llms.d.ts","sourceRoot":"","sources":["../../src/routes/llms.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAE1D,KAAK,YAAY,GAAG,qBAAqB,CAAC;AAC1C,KAAK,aAAa,GAAG,WAAW,CAAC,UAAU,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAehF,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,UAAU,wBAAwB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,aAAa,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,KAAK,iBAAiB,GAAG,CACvB,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,wBAAwB,KAC9B,OAAO,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC;AAE9B,UAAU,sBAAsB;IAC9B,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAA;KAA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;AAED,eAAO,MAAM,uBAAuB,GAAI,wFAOrC,8BAA8B;mBAqLpB,OAAO,cACJ;QAAE,MAAM,EAAE,OAAO,CAAC;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAA;SAAE,CAAC,CAAA;KAAE;yCAmDjE;QACD,MAAM,CAAC,EAAE,OAAO,CAAC;YAAE,IAAI,CAAC,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACrC;;CAgBF,CAAC"}
|
package/dist/routes/llms.js
CHANGED
|
@@ -7,6 +7,7 @@ import { findSmartNotFoundSuggestions, renderSmartNotFoundMarkdown, } from "../i
|
|
|
7
7
|
import { isPageVisibleForSurface } from "../page-visibility.js";
|
|
8
8
|
const INDEX_MARKDOWN_PATTERN = /\/index\.md$/;
|
|
9
9
|
const MARKDOWN_PATTERN = /\.md$/;
|
|
10
|
+
const MARKDOWN_CACHE_CONTROL = "public, max-age=0, s-maxage=86400, stale-while-revalidate=604800";
|
|
10
11
|
const resolveSources = (source, sources, caller) => {
|
|
11
12
|
const resolvedSources = sources ?? (source ? [source] : []);
|
|
12
13
|
if (resolvedSources.length === 0) {
|
|
@@ -158,7 +159,10 @@ export const createLlmsRoute = ({ filterPage, source, sources, transform, }) =>
|
|
|
158
159
|
};
|
|
159
160
|
export const createDocsMarkdownRoute = ({ config, filterStaticParams, notFound: notFoundOptions = {}, source, sources, transform, }) => {
|
|
160
161
|
const routeSources = resolveSources(source, sources, "createDocsMarkdownRoute");
|
|
161
|
-
const routingConfig =
|
|
162
|
+
const routingConfig = {
|
|
163
|
+
...(routeSources[0].routingConfig ?? {}),
|
|
164
|
+
...config,
|
|
165
|
+
};
|
|
162
166
|
const smartNotFoundOptions = notFoundOptions === false ? {} : notFoundOptions;
|
|
163
167
|
const supportedLanguages = new Set([
|
|
164
168
|
routingConfig.defaultLanguage ?? "en",
|
|
@@ -292,7 +296,13 @@ export const createDocsMarkdownRoute = ({ config, filterStaticParams, notFound:
|
|
|
292
296
|
const rendered = await pageSource.getPageMarkdown(page);
|
|
293
297
|
const pageData = page.data;
|
|
294
298
|
const canonicalPath = withBasePath(pageData.canonical ?? page.url, routingConfig.basePath);
|
|
295
|
-
const
|
|
299
|
+
const canonicalUrl = routingConfig.siteUrl
|
|
300
|
+
? new URL(canonicalPath, routingConfig.siteUrl)
|
|
301
|
+
: new URL(canonicalPath, request.url);
|
|
302
|
+
const headers = applyMarkdownHeaders(new Headers({
|
|
303
|
+
"Cache-Control": MARKDOWN_CACHE_CONTROL,
|
|
304
|
+
"Content-Type": "text/markdown",
|
|
305
|
+
}), { canonicalUrl });
|
|
296
306
|
return new Response(transform
|
|
297
307
|
? await transform(rendered, { lang, page, source: pageSource })
|
|
298
308
|
: rendered, {
|
package/dist/source.d.ts
CHANGED
|
@@ -33,12 +33,16 @@ export interface GeistdocsMarkdownContext {
|
|
|
33
33
|
url: string;
|
|
34
34
|
};
|
|
35
35
|
}
|
|
36
|
+
export type GeistdocsMarkdownFrontmatterValue = boolean | Date | number | readonly string[] | string | null | undefined;
|
|
37
|
+
export type GeistdocsMarkdownFrontmatter = Record<string, GeistdocsMarkdownFrontmatterValue>;
|
|
36
38
|
export interface GeistdocsMarkdownOptions {
|
|
39
|
+
/** Add or override fields in the generated Markdown frontmatter. */
|
|
40
|
+
frontmatter?: (defaults: Readonly<GeistdocsMarkdownFrontmatter>, context: GeistdocsMarkdownContext) => GeistdocsMarkdownFrontmatter | Promise<GeistdocsMarkdownFrontmatter>;
|
|
37
41
|
transform?: (markdown: string, context: GeistdocsMarkdownContext) => Promise<string> | string;
|
|
38
42
|
}
|
|
39
43
|
export interface CreateSourceOptions {
|
|
40
44
|
baseUrl?: string;
|
|
41
|
-
config: Pick<GeistdocsConfig, "agent" | "basePath" | "defaultLanguage" | "translations"> & Partial<Pick<GeistdocsConfig, "title">>;
|
|
45
|
+
config: Pick<GeistdocsConfig, "agent" | "basePath" | "defaultLanguage" | "siteUrl" | "translations"> & Partial<Pick<GeistdocsConfig, "title">>;
|
|
42
46
|
docs: FumadocsCollection;
|
|
43
47
|
id?: string;
|
|
44
48
|
label?: string;
|
|
@@ -68,6 +72,7 @@ export declare const createSource: ({ docs, config, baseUrl, id, label, markdown
|
|
|
68
72
|
agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined;
|
|
69
73
|
basePath: string | undefined;
|
|
70
74
|
defaultLanguage: string | undefined;
|
|
75
|
+
siteUrl: string | undefined;
|
|
71
76
|
title: string | undefined;
|
|
72
77
|
translations: import("./config.js").GeistdocsTranslations | undefined;
|
|
73
78
|
};
|
|
@@ -101,6 +106,7 @@ export declare const createSources: ({ config, sources }: CreateSourcesOptions)
|
|
|
101
106
|
agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined;
|
|
102
107
|
basePath: string | undefined;
|
|
103
108
|
defaultLanguage: string | undefined;
|
|
109
|
+
siteUrl: string | undefined;
|
|
104
110
|
title: string | undefined;
|
|
105
111
|
translations: import("./config.js").GeistdocsTranslations | undefined;
|
|
106
112
|
};
|
|
@@ -138,6 +144,7 @@ export declare const createVersionedSources: ({ config, current, versions, }: Cr
|
|
|
138
144
|
agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined;
|
|
139
145
|
basePath: string | undefined;
|
|
140
146
|
defaultLanguage: string | undefined;
|
|
147
|
+
siteUrl: string | undefined;
|
|
141
148
|
title: string | undefined;
|
|
142
149
|
translations: import("./config.js").GeistdocsTranslations | undefined;
|
|
143
150
|
};
|
|
@@ -166,6 +173,7 @@ export declare const createVersionedSources: ({ config, current, versions, }: Cr
|
|
|
166
173
|
agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined;
|
|
167
174
|
basePath: string | undefined;
|
|
168
175
|
defaultLanguage: string | undefined;
|
|
176
|
+
siteUrl: string | undefined;
|
|
169
177
|
title: string | undefined;
|
|
170
178
|
translations: import("./config.js").GeistdocsTranslations | undefined;
|
|
171
179
|
};
|
|
@@ -193,6 +201,7 @@ export declare const createVersionedSources: ({ config, current, versions, }: Cr
|
|
|
193
201
|
agent: import("./config.js").GeistdocsAgentReadinessConfig | undefined;
|
|
194
202
|
basePath: string | undefined;
|
|
195
203
|
defaultLanguage: string | undefined;
|
|
204
|
+
siteUrl: string | undefined;
|
|
196
205
|
title: string | undefined;
|
|
197
206
|
translations: import("./config.js").GeistdocsTranslations | undefined;
|
|
198
207
|
};
|
package/dist/source.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,MAAM,EAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../src/source.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,aAAa,EAClB,MAAM,EAEP,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,oBAAoB,EAG1B,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,qBAAqB,EAE3B,MAAM,6BAA6B,CAAC;AAErC,YAAY,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEzE,KAAK,aAAa,GAAG,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AA0FlD,MAAM,WAAW,kBAAkB;IACjC,gBAAgB,IAAI,aAAa,CAAC,QAAQ,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,WAAW,CAAC,EAAE,oBAAoB,EAAE,CAAC;IACrC,OAAO,CAAC,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC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"fumadocs-core/i18n";
|
|
2
2
|
import { loader, } from "fumadocs-core/source";
|
|
3
3
|
import { getPublicPath, withBasePath, } from "./config.js";
|
|
4
|
+
import { mdxToMarkdown } from "./internal/mdx-to-markdown.js";
|
|
4
5
|
import { stripVersionRoutePrefix, } from "./internal/version-paths.js";
|
|
5
6
|
const MARKDOWN_LINK_PATTERN = /(\]\()(\/(?!\/)[^)\s]*)/g;
|
|
6
7
|
const ROOT_ATTRIBUTE_PATTERN = /(\b(?:href|src)=["'])(\/(?!\/)[^"']*)/g;
|
|
@@ -64,6 +65,40 @@ const getLanguages = (config) => {
|
|
|
64
65
|
languages: Array.from(new Set([defaultLanguage, ...languages])),
|
|
65
66
|
};
|
|
66
67
|
};
|
|
68
|
+
const YAML_NEEDS_QUOTING = /[:#{}[\]&*!|>'"%@`]/;
|
|
69
|
+
const ALWAYS_QUOTED_FRONTMATTER = new Set(["badge", "navTitle"]);
|
|
70
|
+
const formatFrontmatterValue = (value, forceQuotes = false) => {
|
|
71
|
+
if (value instanceof Date) {
|
|
72
|
+
return value.toISOString().slice(0, 10);
|
|
73
|
+
}
|
|
74
|
+
if (typeof value === "string") {
|
|
75
|
+
return forceQuotes ||
|
|
76
|
+
YAML_NEEDS_QUOTING.test(value) ||
|
|
77
|
+
value.trim() !== value
|
|
78
|
+
? JSON.stringify(value)
|
|
79
|
+
: value;
|
|
80
|
+
}
|
|
81
|
+
return String(value);
|
|
82
|
+
};
|
|
83
|
+
const formatFrontmatter = (fields) => {
|
|
84
|
+
const lines = ["---"];
|
|
85
|
+
const isStringArray = (value) => Array.isArray(value);
|
|
86
|
+
for (const [key, value] of Object.entries(fields)) {
|
|
87
|
+
if (value == null || value === false) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
if (isStringArray(value)) {
|
|
91
|
+
if (value.length === 0) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
lines.push(`${key}:`, ...value.map((entry) => ` - ${formatFrontmatterValue(entry)}`));
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
lines.push(`${key}: ${formatFrontmatterValue(value, ALWAYS_QUOTED_FRONTMATTER.has(key))}`);
|
|
98
|
+
}
|
|
99
|
+
lines.push("---");
|
|
100
|
+
return lines.join("\n");
|
|
101
|
+
};
|
|
67
102
|
const pageTreeTransformer = {
|
|
68
103
|
file(node, filePath) {
|
|
69
104
|
if (!filePath) {
|
|
@@ -107,51 +142,56 @@ export const createSource = ({ docs, config, baseUrl = "/docs", id, label, markd
|
|
|
107
142
|
};
|
|
108
143
|
const getPageMarkdown = async (page) => {
|
|
109
144
|
const data = page.data;
|
|
110
|
-
const
|
|
111
|
-
const { title, description, badge, product, type, summary, prerequisites, related, navTitle, internal, noindex, canonical, tags, keywords, excludeFrom, } = data;
|
|
112
|
-
const frontmatter = [
|
|
113
|
-
"---",
|
|
114
|
-
`title: ${title}`,
|
|
115
|
-
description && `description: ${description}`,
|
|
116
|
-
badge && `badge: ${JSON.stringify(badge)}`,
|
|
117
|
-
product && `product: ${product}`,
|
|
118
|
-
navTitle && `navTitle: ${JSON.stringify(navTitle)}`,
|
|
119
|
-
type && `type: ${type}`,
|
|
120
|
-
summary && `summary: ${summary}`,
|
|
121
|
-
internal && "internal: true",
|
|
122
|
-
noindex && "noindex: true",
|
|
123
|
-
canonical && `canonical: ${canonical}`,
|
|
124
|
-
tags?.length && `tags:\n${tags.map((tag) => ` - ${tag}`).join("\n")}`,
|
|
125
|
-
keywords?.length &&
|
|
126
|
-
`keywords:\n${keywords.map((keyword) => ` - ${keyword}`).join("\n")}`,
|
|
127
|
-
excludeFrom?.length &&
|
|
128
|
-
`excludeFrom:\n${excludeFrom.map((surface) => ` - ${surface}`).join("\n")}`,
|
|
129
|
-
prerequisites?.length &&
|
|
130
|
-
`prerequisites:\n${prerequisites
|
|
131
|
-
.map((prerequisite) => ` - ${prerequisite}`)
|
|
132
|
-
.join("\n")}`,
|
|
133
|
-
related?.length &&
|
|
134
|
-
`related:\n${related
|
|
135
|
-
.map((entry) => ` - ${entry}`)
|
|
136
|
-
.join("\n")}`,
|
|
137
|
-
"---",
|
|
138
|
-
]
|
|
139
|
-
.filter(Boolean)
|
|
140
|
-
.join("\n");
|
|
145
|
+
const content = await mdxToMarkdown(await data.getText("processed"));
|
|
146
|
+
const { title, description, badge, product, type, summary, prerequisites, related, navTitle, internal, noindex, canonical, tags, keywords, excludeFrom, lastModified, } = data;
|
|
141
147
|
const sitemapPath = "/sitemap.md";
|
|
142
148
|
const llmsPath = "/llms.txt";
|
|
143
149
|
const agentsPath = "/agents.md";
|
|
144
150
|
const sitemapLabel = getPublicPath(sitemapPath, config.basePath);
|
|
145
151
|
const llmsLabel = getPublicPath(llmsPath, config.basePath);
|
|
146
152
|
const agentsLabel = getPublicPath(agentsPath, config.basePath);
|
|
153
|
+
const pagePath = canonical
|
|
154
|
+
? withBasePath(canonical, config.basePath)
|
|
155
|
+
: getPublicPath(page.url, config.basePath);
|
|
156
|
+
const defaults = {
|
|
157
|
+
title,
|
|
158
|
+
description,
|
|
159
|
+
url: config.siteUrl
|
|
160
|
+
? new URL(pagePath, config.siteUrl).toString()
|
|
161
|
+
: undefined,
|
|
162
|
+
docs_index: llmsLabel,
|
|
163
|
+
lastUpdated: lastModified,
|
|
164
|
+
badge,
|
|
165
|
+
product,
|
|
166
|
+
navTitle,
|
|
167
|
+
type,
|
|
168
|
+
summary,
|
|
169
|
+
internal,
|
|
170
|
+
noindex,
|
|
171
|
+
canonical,
|
|
172
|
+
tags,
|
|
173
|
+
keywords,
|
|
174
|
+
excludeFrom,
|
|
175
|
+
prerequisites,
|
|
176
|
+
related,
|
|
177
|
+
};
|
|
178
|
+
const context = {
|
|
179
|
+
page: page,
|
|
180
|
+
};
|
|
181
|
+
const overrides = markdown?.frontmatter
|
|
182
|
+
? await markdown.frontmatter(defaults, context)
|
|
183
|
+
: {};
|
|
184
|
+
const fields = { ...defaults, ...overrides };
|
|
185
|
+
const frontmatter = formatFrontmatter(fields);
|
|
186
|
+
const docsIndex = typeof fields.docs_index === "string" ? fields.docs_index : llmsLabel;
|
|
147
187
|
const agentDiscoveryLink = config.agent && config.agent.enabled !== false
|
|
148
188
|
? `\n\nFor agent-facing discovery, including API and MCP surfaces, see [${agentsLabel}](${agentsPath})`
|
|
149
189
|
: "";
|
|
150
190
|
const rendered = `${frontmatter}
|
|
151
191
|
|
|
152
|
-
|
|
192
|
+
> For an index of all documentation, see [${docsIndex}](${docsIndex}).
|
|
153
193
|
|
|
154
|
-
${
|
|
194
|
+
${content}
|
|
155
195
|
|
|
156
196
|
---
|
|
157
197
|
|
|
@@ -160,7 +200,7 @@ For a semantic overview of all documentation, see [${sitemapLabel}](${sitemapPat
|
|
|
160
200
|
For an index of all available documentation, see [${llmsLabel}](${llmsPath})${agentDiscoveryLink}`;
|
|
161
201
|
const transformed = markdown?.transform
|
|
162
202
|
? await markdown.transform(rendered, {
|
|
163
|
-
|
|
203
|
+
...context,
|
|
164
204
|
})
|
|
165
205
|
: rendered;
|
|
166
206
|
return prefixMarkdownLinks(transformed, config.basePath);
|
|
@@ -171,6 +211,7 @@ For an index of all available documentation, see [${llmsLabel}](${llmsPath})${ag
|
|
|
171
211
|
agent: config.agent,
|
|
172
212
|
basePath: config.basePath,
|
|
173
213
|
defaultLanguage: config.defaultLanguage,
|
|
214
|
+
siteUrl: config.siteUrl,
|
|
174
215
|
title: config.title,
|
|
175
216
|
translations: config.translations,
|
|
176
217
|
},
|
package/docs/agents.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Docs
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 1.25.1-canary.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 1.25.1-canary.6c2bd30 so agents can understand the installed package without web access.
|
|
4
4
|
They are generated from `apps/template/content/docs` during the package build.
|
|
5
5
|
|
|
6
6
|
## How to use these files
|
package/docs/llms.txt
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Geistdocs Package Documentation
|
|
2
2
|
|
|
3
|
-
These docs are bundled with `@vercel/geistdocs` 1.25.1-canary.
|
|
3
|
+
These docs are bundled with `@vercel/geistdocs` 1.25.1-canary.6c2bd30.
|
|
4
4
|
They describe how to build package-backed Geistdocs sites and how to use the package APIs from generated project adapters.
|
|
5
5
|
|
|
6
6
|
## Documentation Index
|
|
@@ -1563,6 +1563,44 @@ Add images with ``:
|
|
|
1563
1563
|

|
|
1564
1564
|
```
|
|
1565
1565
|
|
|
1566
|
+
Use `<Image>` when an image needs the standard documentation presentation and
|
|
1567
|
+
an optional description. It uses Geistcn's image component without a lightbox
|
|
1568
|
+
or other interaction:
|
|
1569
|
+
|
|
1570
|
+
```mdx
|
|
1571
|
+
<Image
|
|
1572
|
+
alt="Deployment graph"
|
|
1573
|
+
caption="Requests move from the edge to the selected region."
|
|
1574
|
+
height={480}
|
|
1575
|
+
src="/deployment-graph.png"
|
|
1576
|
+
width={800}
|
|
1577
|
+
/>
|
|
1578
|
+
```
|
|
1579
|
+
|
|
1580
|
+
This renders as:
|
|
1581
|
+
|
|
1582
|
+
<Image
|
|
1583
|
+
alt="Navigation Inspector showing a loading shell for a page load"
|
|
1584
|
+
caption="The Navigation Inspector paused on a page load."
|
|
1585
|
+
height={389}
|
|
1586
|
+
srcDark="https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/dark/inspector-load.png"
|
|
1587
|
+
srcLight="https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/light/inspector-load.png"
|
|
1588
|
+
width={472}
|
|
1589
|
+
/>
|
|
1590
|
+
|
|
1591
|
+
For theme-aware images, provide both sources:
|
|
1592
|
+
|
|
1593
|
+
```mdx
|
|
1594
|
+
<Image
|
|
1595
|
+
alt="Deployment graph"
|
|
1596
|
+
caption="Requests move from the edge to the selected region."
|
|
1597
|
+
height={480}
|
|
1598
|
+
srcDark="/deployment-graph-dark.png"
|
|
1599
|
+
srcLight="/deployment-graph-light.png"
|
|
1600
|
+
width={800}
|
|
1601
|
+
/>
|
|
1602
|
+
```
|
|
1603
|
+
|
|
1566
1604
|
## GitHub Flavored Markdown
|
|
1567
1605
|
|
|
1568
1606
|
Geistdocs supports GFM extensions including tables, task lists, and autolinks.
|
|
@@ -2608,7 +2646,7 @@ related:
|
|
|
2608
2646
|
|
|
2609
2647
|
# .md Extension
|
|
2610
2648
|
|
|
2611
|
-
Geistdocs lets AI tools and language models access documentation pages as plain Markdown. Append `.md` or `.mdx` to a documentation URL to get the
|
|
2649
|
+
Geistdocs lets AI tools and language models access documentation pages as plain Markdown. Append `.md` or `.mdx` to a documentation URL to get the page content with presentation-only MDX components removed.
|
|
2612
2650
|
|
|
2613
2651
|
Help me test raw Markdown routes in this Geistdocs project. Fetch a docs page with `.mdx` appended, compare it to the rendered page, and explain how AI tools can use it.
|
|
2614
2652
|
|
|
@@ -2628,8 +2666,8 @@ https://yourdomain.com/docs/getting-started.mdx
|
|
|
2628
2666
|
|
|
2629
2667
|
The `.mdx` version returns:
|
|
2630
2668
|
|
|
2631
|
-
-
|
|
2632
|
-
- The full
|
|
2669
|
+
- Frontmatter with the canonical page URL, docs index, and last-updated date when available
|
|
2670
|
+
- The full page content as plain Markdown
|
|
2633
2671
|
- No HTML, styling, or navigation
|
|
2634
2672
|
|
|
2635
2673
|
For a docs section mounted at `/docs`, the section root remains `/docs.md`. For a source mounted at the app root with `baseUrl: "/"`, Geistdocs uses `/index.md` for the root page. If Next.js has `basePath: "/docs"`, that public root Markdown URL is `/docs/index.md`.
|
|
@@ -2678,11 +2716,30 @@ The response includes:
|
|
|
2678
2716
|
|
|
2679
2717
|
- Content-Type: `text/markdown`
|
|
2680
2718
|
- `Link: <canonical page URL>; rel="canonical"` for resolved pages
|
|
2681
|
-
-
|
|
2682
|
-
-
|
|
2719
|
+
- Frontmatter with page metadata and discovery links
|
|
2720
|
+
- Page content with presentation-only MDX components removed
|
|
2683
2721
|
|
|
2684
2722
|
All MDX components are processed and converted to plain Markdown equivalents.
|
|
2685
2723
|
|
|
2724
|
+
### Customize frontmatter
|
|
2725
|
+
|
|
2726
|
+
Geistdocs generates `title`, `description`, `url`, `docs_index`, and `lastUpdated` when their values are available, along with supported page frontmatter such as `prerequisites` and `related`. Add product-specific fields or override defaults with the source `markdown.frontmatter` hook:
|
|
2727
|
+
|
|
2728
|
+
```ts title="lib/geistdocs/source.ts"
|
|
2729
|
+
export const geistdocsSource = createSource({
|
|
2730
|
+
config,
|
|
2731
|
+
docs,
|
|
2732
|
+
markdown: {
|
|
2733
|
+
frontmatter: (defaults) => ({
|
|
2734
|
+
docs_index: "/docs/llms.txt",
|
|
2735
|
+
version: "16.3.4",
|
|
2736
|
+
}),
|
|
2737
|
+
},
|
|
2738
|
+
});
|
|
2739
|
+
```
|
|
2740
|
+
|
|
2741
|
+
The callback returns only additions and overrides; Geistdocs keeps the remaining generated fields from `defaults`.
|
|
2742
|
+
|
|
2686
2743
|
## Missing documentation pages
|
|
2687
2744
|
|
|
2688
2745
|
When a Markdown request does not match a page, Geistdocs returns an agent-readable `Page Not Found` response. It compares the requested path with visible page paths and titles, then links up to five likely matches with their descriptions. If no match is useful, the response links to `/llms.txt` instead.
|
package/docs/manifest.json
CHANGED
package/docs/pages/md.md
CHANGED
|
@@ -13,7 +13,7 @@ related:
|
|
|
13
13
|
|
|
14
14
|
# .md Extension
|
|
15
15
|
|
|
16
|
-
Geistdocs lets AI tools and language models access documentation pages as plain Markdown. Append `.md` or `.mdx` to a documentation URL to get the
|
|
16
|
+
Geistdocs lets AI tools and language models access documentation pages as plain Markdown. Append `.md` or `.mdx` to a documentation URL to get the page content with presentation-only MDX components removed.
|
|
17
17
|
|
|
18
18
|
Help me test raw Markdown routes in this Geistdocs project. Fetch a docs page with `.mdx` appended, compare it to the rendered page, and explain how AI tools can use it.
|
|
19
19
|
|
|
@@ -33,8 +33,8 @@ https://yourdomain.com/docs/getting-started.mdx
|
|
|
33
33
|
|
|
34
34
|
The `.mdx` version returns:
|
|
35
35
|
|
|
36
|
-
-
|
|
37
|
-
- The full
|
|
36
|
+
- Frontmatter with the canonical page URL, docs index, and last-updated date when available
|
|
37
|
+
- The full page content as plain Markdown
|
|
38
38
|
- No HTML, styling, or navigation
|
|
39
39
|
|
|
40
40
|
For a docs section mounted at `/docs`, the section root remains `/docs.md`. For a source mounted at the app root with `baseUrl: "/"`, Geistdocs uses `/index.md` for the root page. If Next.js has `basePath: "/docs"`, that public root Markdown URL is `/docs/index.md`.
|
|
@@ -83,11 +83,30 @@ The response includes:
|
|
|
83
83
|
|
|
84
84
|
- Content-Type: `text/markdown`
|
|
85
85
|
- `Link: <canonical page URL>; rel="canonical"` for resolved pages
|
|
86
|
-
-
|
|
87
|
-
-
|
|
86
|
+
- Frontmatter with page metadata and discovery links
|
|
87
|
+
- Page content with presentation-only MDX components removed
|
|
88
88
|
|
|
89
89
|
All MDX components are processed and converted to plain Markdown equivalents.
|
|
90
90
|
|
|
91
|
+
### Customize frontmatter
|
|
92
|
+
|
|
93
|
+
Geistdocs generates `title`, `description`, `url`, `docs_index`, and `lastUpdated` when their values are available, along with supported page frontmatter such as `prerequisites` and `related`. Add product-specific fields or override defaults with the source `markdown.frontmatter` hook:
|
|
94
|
+
|
|
95
|
+
```ts title="lib/geistdocs/source.ts"
|
|
96
|
+
export const geistdocsSource = createSource({
|
|
97
|
+
config,
|
|
98
|
+
docs,
|
|
99
|
+
markdown: {
|
|
100
|
+
frontmatter: (defaults) => ({
|
|
101
|
+
docs_index: "/docs/llms.txt",
|
|
102
|
+
version: "16.3.4",
|
|
103
|
+
}),
|
|
104
|
+
},
|
|
105
|
+
});
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
The callback returns only additions and overrides; Geistdocs keeps the remaining generated fields from `defaults`.
|
|
109
|
+
|
|
91
110
|
## Missing documentation pages
|
|
92
111
|
|
|
93
112
|
When a Markdown request does not match a page, Geistdocs returns an agent-readable `Page Not Found` response. It compares the requested path with visible page paths and titles, then links up to five likely matches with their descriptions. If no match is useful, the response links to `/llms.txt` instead.
|
package/docs/pages/syntax.md
CHANGED
|
@@ -211,6 +211,44 @@ Add images with ``:
|
|
|
211
211
|

|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
+
Use `<Image>` when an image needs the standard documentation presentation and
|
|
215
|
+
an optional description. It uses Geistcn's image component without a lightbox
|
|
216
|
+
or other interaction:
|
|
217
|
+
|
|
218
|
+
```mdx
|
|
219
|
+
<Image
|
|
220
|
+
alt="Deployment graph"
|
|
221
|
+
caption="Requests move from the edge to the selected region."
|
|
222
|
+
height={480}
|
|
223
|
+
src="/deployment-graph.png"
|
|
224
|
+
width={800}
|
|
225
|
+
/>
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
This renders as:
|
|
229
|
+
|
|
230
|
+
<Image
|
|
231
|
+
alt="Navigation Inspector showing a loading shell for a page load"
|
|
232
|
+
caption="The Navigation Inspector paused on a page load."
|
|
233
|
+
height={389}
|
|
234
|
+
srcDark="https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/dark/inspector-load.png"
|
|
235
|
+
srcLight="https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/light/inspector-load.png"
|
|
236
|
+
width={472}
|
|
237
|
+
/>
|
|
238
|
+
|
|
239
|
+
For theme-aware images, provide both sources:
|
|
240
|
+
|
|
241
|
+
```mdx
|
|
242
|
+
<Image
|
|
243
|
+
alt="Deployment graph"
|
|
244
|
+
caption="Requests move from the edge to the selected region."
|
|
245
|
+
height={480}
|
|
246
|
+
srcDark="/deployment-graph-dark.png"
|
|
247
|
+
srcLight="/deployment-graph-light.png"
|
|
248
|
+
width={800}
|
|
249
|
+
/>
|
|
250
|
+
```
|
|
251
|
+
|
|
214
252
|
## GitHub Flavored Markdown
|
|
215
253
|
|
|
216
254
|
Geistdocs supports GFM extensions including tables, task lists, and autolinks.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vercel/geistdocs",
|
|
3
3
|
"description": "Runtime and CLI for Geistdocs projects.",
|
|
4
|
-
"version": "1.25.1-canary.
|
|
4
|
+
"version": "1.25.1-canary.6c2bd30",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -155,6 +155,10 @@
|
|
|
155
155
|
"types": "./dist/components/copy-prompt.d.ts",
|
|
156
156
|
"default": "./dist/components/copy-prompt.js"
|
|
157
157
|
},
|
|
158
|
+
"./components/image": {
|
|
159
|
+
"types": "./dist/components/image.d.ts",
|
|
160
|
+
"default": "./dist/components/image.js"
|
|
161
|
+
},
|
|
158
162
|
"./components/dropdown-menu": {
|
|
159
163
|
"types": "./dist/components/dropdown-menu.d.ts",
|
|
160
164
|
"default": "./dist/components/dropdown-menu.js"
|
|
@@ -215,6 +219,7 @@
|
|
|
215
219
|
"remark-gfm": "^4.0.1",
|
|
216
220
|
"remark-mdx": "^3.1.1",
|
|
217
221
|
"remark-parse": "^11.0.0",
|
|
222
|
+
"remark-stringify": "^11.0.0",
|
|
218
223
|
"streamdown": "^2.1.0",
|
|
219
224
|
"ts-morph": "^27.0.2",
|
|
220
225
|
"tw-animate-css": "^1.4.0",
|
|
@@ -9,7 +9,7 @@ related:
|
|
|
9
9
|
- /docs/proxy
|
|
10
10
|
---
|
|
11
11
|
|
|
12
|
-
Geistdocs lets AI tools and language models access documentation pages as plain Markdown. Append `.md` or `.mdx` to a documentation URL to get the
|
|
12
|
+
Geistdocs lets AI tools and language models access documentation pages as plain Markdown. Append `.md` or `.mdx` to a documentation URL to get the page content with presentation-only MDX components removed.
|
|
13
13
|
|
|
14
14
|
<CopyPrompt text="Help me test raw Markdown routes in this Geistdocs project. Fetch a docs page with .mdx appended, compare it to the rendered page, and explain how AI tools can use it.">
|
|
15
15
|
Help me test raw Markdown routes in this Geistdocs project. Fetch a docs page with `.mdx` appended, compare it to the rendered page, and explain how AI tools can use it.
|
|
@@ -31,8 +31,8 @@ https://yourdomain.com/docs/getting-started.mdx
|
|
|
31
31
|
|
|
32
32
|
The `.mdx` version returns:
|
|
33
33
|
|
|
34
|
-
-
|
|
35
|
-
- The full
|
|
34
|
+
- Frontmatter with the canonical page URL, docs index, and last-updated date when available
|
|
35
|
+
- The full page content as plain Markdown
|
|
36
36
|
- No HTML, styling, or navigation
|
|
37
37
|
|
|
38
38
|
For a docs section mounted at `/docs`, the section root remains `/docs.md`. For a source mounted at the app root with `baseUrl: "/"`, Geistdocs uses `/index.md` for the root page. If Next.js has `basePath: "/docs"`, that public root Markdown URL is `/docs/index.md`.
|
|
@@ -81,11 +81,30 @@ The response includes:
|
|
|
81
81
|
|
|
82
82
|
- Content-Type: `text/markdown`
|
|
83
83
|
- `Link: <canonical page URL>; rel="canonical"` for resolved pages
|
|
84
|
-
-
|
|
85
|
-
-
|
|
84
|
+
- Frontmatter with page metadata and discovery links
|
|
85
|
+
- Page content with presentation-only MDX components removed
|
|
86
86
|
|
|
87
87
|
All MDX components are processed and converted to plain Markdown equivalents.
|
|
88
88
|
|
|
89
|
+
### Customize frontmatter
|
|
90
|
+
|
|
91
|
+
Geistdocs generates `title`, `description`, `url`, `docs_index`, and `lastUpdated` when their values are available, along with supported page frontmatter such as `prerequisites` and `related`. Add product-specific fields or override defaults with the source `markdown.frontmatter` hook:
|
|
92
|
+
|
|
93
|
+
```ts title="lib/geistdocs/source.ts"
|
|
94
|
+
export const geistdocsSource = createSource({
|
|
95
|
+
config,
|
|
96
|
+
docs,
|
|
97
|
+
markdown: {
|
|
98
|
+
frontmatter: (defaults) => ({
|
|
99
|
+
docs_index: "/docs/llms.txt",
|
|
100
|
+
version: "16.3.4",
|
|
101
|
+
}),
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The callback returns only additions and overrides; Geistdocs keeps the remaining generated fields from `defaults`.
|
|
107
|
+
|
|
89
108
|
## Missing documentation pages
|
|
90
109
|
|
|
91
110
|
When a Markdown request does not match a page, Geistdocs returns an agent-readable `Page Not Found` response. It compares the requested path with visible page paths and titles, then links up to five likely matches with their descriptions. If no match is useful, the response links to `/llms.txt` instead.
|
|
@@ -215,6 +215,44 @@ Add images with ``:
|
|
|
215
215
|

|
|
216
216
|
```
|
|
217
217
|
|
|
218
|
+
Use `<Image>` when an image needs the standard documentation presentation and
|
|
219
|
+
an optional description. It uses Geistcn's image component without a lightbox
|
|
220
|
+
or other interaction:
|
|
221
|
+
|
|
222
|
+
```mdx
|
|
223
|
+
<Image
|
|
224
|
+
alt="Deployment graph"
|
|
225
|
+
caption="Requests move from the edge to the selected region."
|
|
226
|
+
height={480}
|
|
227
|
+
src="/deployment-graph.png"
|
|
228
|
+
width={800}
|
|
229
|
+
/>
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
This renders as:
|
|
233
|
+
|
|
234
|
+
<Image
|
|
235
|
+
alt="Navigation Inspector showing a loading shell for a page load"
|
|
236
|
+
caption="The Navigation Inspector paused on a page load."
|
|
237
|
+
height={389}
|
|
238
|
+
srcDark="https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/dark/inspector-load.png"
|
|
239
|
+
srcLight="https://h8DxKfmAPhn8O0p3.public.blob.vercel-storage.com/docs/light/inspector-load.png"
|
|
240
|
+
width={472}
|
|
241
|
+
/>
|
|
242
|
+
|
|
243
|
+
For theme-aware images, provide both sources:
|
|
244
|
+
|
|
245
|
+
```mdx
|
|
246
|
+
<Image
|
|
247
|
+
alt="Deployment graph"
|
|
248
|
+
caption="Requests move from the edge to the selected region."
|
|
249
|
+
height={480}
|
|
250
|
+
srcDark="/deployment-graph-dark.png"
|
|
251
|
+
srcLight="/deployment-graph-light.png"
|
|
252
|
+
width={800}
|
|
253
|
+
/>
|
|
254
|
+
```
|
|
255
|
+
|
|
218
256
|
## GitHub Flavored Markdown
|
|
219
257
|
|
|
220
258
|
Geistdocs supports GFM extensions including tables, task lists, and autolinks.
|
package/template/next.config.ts
CHANGED
|
@@ -23,6 +23,15 @@ const environment = process.env.VERCEL_ENV ?? process.env.NODE_ENV;
|
|
|
23
23
|
const envFavicon = ENV_FAVICONS[environment as keyof typeof ENV_FAVICONS];
|
|
24
24
|
|
|
25
25
|
const config: NextConfig = {
|
|
26
|
+
images: {
|
|
27
|
+
remotePatterns: [
|
|
28
|
+
{
|
|
29
|
+
hostname: "h8dxkfmaphn8o0p3.public.blob.vercel-storage.com",
|
|
30
|
+
pathname: "/docs/**",
|
|
31
|
+
protocol: "https",
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
26
35
|
modularizeImports: {
|
|
27
36
|
"@vercel/geistcn/components": {
|
|
28
37
|
skipDefaultConversion: true,
|
package/template/package.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"@vercel/analytics": "^1.6.1",
|
|
20
20
|
"@vercel/geistcn": "1.0.4",
|
|
21
21
|
"@vercel/geistcn-assets": "2.1.0",
|
|
22
|
-
"@vercel/geistdocs": "1.25.1-canary.
|
|
22
|
+
"@vercel/geistdocs": "1.25.1-canary.6c2bd30",
|
|
23
23
|
"@vercel/speed-insights": "^1.3.1",
|
|
24
24
|
"ai": "^6.0.132",
|
|
25
25
|
"class-variance-authority": "^0.7.1",
|