@stacksjs/bunpress 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin/cli.js +1 -1
- package/dist/bin/commands/doctor.d.ts +1 -0
- package/dist/bin/commands/seo.d.ts +19 -0
- package/dist/{chunk-trhgd2dy.js → chunk-desvs9bx.js} +1 -1
- package/dist/{chunk-n0ebp7d8.js → chunk-em1tv2bw.js} +1 -1
- package/dist/{chunk-2ns9va8d.js → chunk-kfbpnqaw.js} +108 -347
- package/dist/chunk-qqn901qf.js +393 -0
- package/dist/{chunk-av14gbps.js → chunk-qzhr4d2q.js} +1 -1
- package/dist/{chunk-fyb5bzsp.js → chunk-y3z183hg.js} +1 -1
- package/dist/chunk-yfwm5337.js +2 -0
- package/dist/{chunk-avg4ftb9.js → chunk-zkdm5pr7.js} +249 -7
- package/dist/src/index.js +1 -1
- package/dist/src/markdown-fences.d.ts +37 -0
- package/dist/src/toc.d.ts +14 -0
- package/package.json +1 -1
- package/dist/chunk-w615shtf.js +0 -2
- package/dist/chunk-x5m3c6jd.js +0 -469
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{aa as m,da as A}from"./chunk-em1tv2bw.js";import{loadConfig as u}from"bunfig";var h={docsDir:"./docs",outDir:"./dist",theme:"vitepress",nav:[{text:"Guide",link:"/install"},{text:"API",link:"/advanced#api-reference"},{text:"Examples",link:"/examples"}],plugins:[],markdown:{title:"BunPress Documentation",meta:{description:"Documentation built with BunPress",generator:"BunPress",viewport:"width=device-width, initial-scale=1.0"},sidebar:{"/":[{text:"Getting Started",items:[{text:"Introduction",link:"/"},{text:"Installation",link:"/install"},{text:"Quick Start",link:"/quick-start"},{text:"Usage",link:"/usage"},{text:"Configuration",link:"/config"}]},{text:"Core Features",items:[{text:"Features Overview",link:"/features"},{text:"Markdown Extensions",link:"/markdown-extensions"},{text:"Syntax Highlighting",link:"/syntax-highlighting"},{text:"Table of Contents",link:"/table-of-contents"},{text:"CLI Commands",link:"/cli"}]},{text:"SEO & Analytics",items:[{text:"SEO Features",link:"/seo"},{text:"Analytics (Fathom)",link:"/config#fathom-analytics-configuration"}]},{text:"Advanced",items:[{text:"Advanced Usage",link:"/advanced"},{text:"Examples",link:"/examples"},{text:"Best Practices",link:"/best-practices"}]},{text:"More",items:[{text:"Showcase",link:"/showcase"},{text:"Partners",link:"/partners"},{text:"License",link:"/license"},{text:"Postcardware",link:"/postcardware"}]}]},css:`
|
|
3
3
|
/* Additional BunPress customizations */
|
|
4
4
|
/* Note: Base styles are provided by the VitePress theme */
|
|
5
5
|
|
|
@@ -1146,9 +1146,251 @@ if (typeof document !== 'undefined') {
|
|
|
1146
1146
|
}
|
|
1147
1147
|
});
|
|
1148
1148
|
}
|
|
1149
|
-
`],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function
|
|
1150
|
-
`).filter((
|
|
1151
|
-
`)}function
|
|
1152
|
-
`),
|
|
1153
|
-
`))
|
|
1154
|
-
|
|
1149
|
+
`],preserveDirectoryStructure:!0,features:{inlineFormatting:!0,containers:!0,githubAlerts:!0,codeBlocks:{lineHighlighting:!0,lineNumbers:!0,focus:!0,diffs:!0,errorWarningMarkers:!0},codeGroups:!0,codeImports:!0,inlineToc:!0,customAnchors:!0,emoji:!0,badges:!0,includes:!0,externalLinks:{autoTarget:!0,autoRel:!0,showIcon:!0},imageLazyLoading:!0,tables:{alignment:!0,enhancedStyling:!0,responsive:!0}},syntaxHighlightTheme:"github-light"},search:{enabled:!0,maxResults:12,keyboardShortcuts:!0},themeConfig:{socialLinks:[{icon:"github",link:"https://github.com/stacksjs/bunpress"}]},verbose:!1,sitemap:{enabled:!0,filename:"sitemap.xml",defaultPriority:0.5,defaultChangefreq:"monthly",maxUrlsPerFile:50000,useSitemapIndex:!1},robots:{enabled:!0,filename:"robots.txt"}};function g(Q){let V=Q.plugins;if(!Array.isArray(V)||V.length===0)return Q;let W=Q;for(let X of V){if(!X||typeof X!=="object")continue;let Z=X.name||"unnamed plugin";try{if(typeof X.extendConfig==="function")W=X.extendConfig(W)??W}catch($){console.error(`[bunpress] ${Z}: extendConfig failed \u2014`,$)}try{if(typeof X.validateConfig==="function"){let $=X.validateConfig(W);for(let j of $?.warnings??[])console.warn(`[bunpress] ${Z}: ${j}`);for(let j of $?.errors??[])console.error(`[bunpress] ${Z}: ${j}`)}}catch($){console.error(`[bunpress] ${Z}: validateConfig failed \u2014`,$)}}for(let X of V)try{X?.onConfigLoad?.(W)}catch(Z){console.error(`[bunpress] ${X?.name||"unnamed plugin"}: onConfigLoad failed \u2014`,Z)}return W}var d=g(await u({name:"bunpress",alias:"docs",defaultConfig:h}));async function YQ(){return d}function E(){let Q=null;return(V)=>{let W=V.match(/^\s{0,3}(`{3,}|~{3,})(.*)$/);if(!W)return Q!==null;let X=W[1];if(Q===null)return Q=X,!0;let Z=X[0]===Q[0],$=X.length>=Q.length;if(Z&&$&&W[2].trim()==="")Q=null;return!0}}function w(Q){let V=E();return Q.split(`
|
|
1150
|
+
`).filter((W)=>!V(W)).join(`
|
|
1151
|
+
`)}function L(Q){return`\x00BPCODE${Q}\x00`}var c=/\u0000BPCODE(\d+)\u0000/g;function l(Q){let V=[],W=E(),X=[],Z=null,$=()=>{if(!Z)return;V.push(Z.join(`
|
|
1152
|
+
`)),X.push(L(V.length-1)),Z=null};for(let j of Q.split(`
|
|
1153
|
+
`)){if(W(j)){Z??=[],Z.push(j);continue}$(),X.push(j.replace(/(`+)(?:(?!\1)[\s\S])*\1/g,(J)=>{return V.push(J),L(V.length-1)}))}return $(),{masked:X.join(`
|
|
1154
|
+
`),restore:(j)=>j.replace(c,(J,Y)=>V[Number(Y)]??J)}}async function KQ(Q,V){let{masked:W,restore:X}=l(Q);return X(await V(W))}var s={enabled:!0,position:["sidebar"],title:"Table of Contents",maxDepth:6,minDepth:2,className:"table-of-contents",smoothScroll:!0,activeHighlight:!0,collapsible:!0,exclude:[]};function y(Q){return Q.replace(/\s*<!-- toc-ignore -->\s*/g,"").replace(/!\[[^\]]*\]\([^)]*\)/g,"").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/\*\*(.+?)\*\*/g,"$1").replace(/__(.+?)__/g,"$1").replace(/\*(.+?)\*/g,"$1").replace(/_(.+?)_/g,"$1").replace(/~~(.+?)~~/g,"$1").replace(/<[^>]*>/g,"").trim()}function D(Q){return Q.toLowerCase().trim().replace(/<[^>]*>/g,"").replace(/what's new\?\s*\(v2\.0\)/g,"whats-new-v2-0").replace(/features\s*&\s*benefits/g,"features-benefits").replace(/vue\.js\s*\+\s*typescript\s*=\s*\u2764\uFE0F/g,"vue-js-typescript").replace(/\//g,"-").replace(/\./g,"-").replace(/[^\w\s-]/g,"").replace(/[\s_]+/g,"-").replace(/-+/g,"-").replace(/^-+|-+$/g,"")}function O(Q,V){let W=Q,X=1;while(V.has(Q))Q=`${W}-${X}`,X++;return V.add(Q),Q}function P(Q,V){return O(D(Q),V)}function a(Q){let V=[],W=new Set,X=/^(#{1,6})\s+(.+)$/gm,Z;while((Z=X.exec(Q))!==null){let $=Z[1].length,j=Z[2].trim();if(!j)continue;if(j.includes("toc-ignore"))continue;let J=j.replace(/\s*<!-- toc-ignore -->\s*/g,"").trim();J=J.replace(/`([^`]+)`/g,"<code>$1</code>");let Y=J.includes("<code>"),q=P(y(j),W);V.push({level:$,text:J,id:q,children:[],hasCode:Y})}return V}function i(Q){let V=[],W=[];for(let X of Q){while(W.length>0&&W[W.length-1].level>=X.level)W.pop();if(W.length===0)V.push(X);else W[W.length-1].children.push(X);W.push(X)}return V}function o(Q,V){let{minDepth:W=2,maxDepth:X=6,exclude:Z=[]}=V,$=(j)=>{let J=[];for(let Y of j){if(Z.some((G)=>{if(G.startsWith("/")&&G.endsWith("/"))return new RegExp(G.slice(1,-1)).test(Y.text);else return Y.text===G}))continue;if(Y.level>X)continue;let q=$(Y.children);if(Y.level>=W&&Y.level<=X)J.push({...Y,children:q});else J.push(...q)}return J};return $(Q)}function _(Q){let{items:V,title:W,config:X}=Q,{className:Z,collapsible:$}=X,j=(J,Y=0)=>{if(J.length===0)return"";let q=Y===0?"toc-list":"toc-sublist",G=Y===0?"toc-item":"toc-subitem";return`<ul class="${q}">
|
|
1155
|
+
${J.map((z)=>{let I=z.children.length>0,K=I&&$?"toc-expand":"",M=I?j(z.children,Y+1):"",U=50,B=z.text.length>50?`${z.text.substring(0,50)}...`:z.text,N=z.text.length>50?"toc-truncate":"";return`<li class="${z.hasCode?"toc-code":""} ${K} ${G} ${N}">
|
|
1156
|
+
<a href="#${z.id}" class="toc-link" title="${z.text.replace(/<[^>]*>/g,"")}">${B}</a>
|
|
1157
|
+
${M}
|
|
1158
|
+
</li>`}).join(`
|
|
1159
|
+
`)}
|
|
1160
|
+
</ul>`};return[`<nav class="${Z}" role="navigation" aria-label="${W}">`,'<div class="toc-container">',` <h2 class="toc-title">${W}</h2>`,` ${j(V)}`,"</div>","</nav>"].join(`
|
|
1161
|
+
`)}function C(Q){return _(Q).replace("table-of-contents","table-of-contents toc-inline inline-toc")}function r(Q){return _(Q).replace("table-of-contents","table-of-contents toc-sidebar sidebar-toc")}function n(Q){return _(Q).replace("table-of-contents","table-of-contents toc-floating floating-toc")}function t(Q,V={}){let W={...V};if(typeof W.position==="string")W.position=[W.position];let X={...s,...W},Z=a(Q),$=i(Z),j=o($,X);return{title:X.title,items:j,config:X}}function zQ(Q,V={}){let W=t(Q,V);return(Array.isArray(V.position)?V.position:[V.position||"sidebar"]).map((Z)=>{let $;switch(Z){case"inline":$=C(W);break;case"sidebar":$=r(W);break;case"floating":$=n(W);break;default:$=_(W)}return{position:Z,data:W,html:$}})}function BQ(Q,V){let W=C(V);return Q.replace(/\[\[toc\]\]/gi,W)}function IQ(Q){let V=new Set;return Q.replace(/<h([1-6])>(.*?)<\/h[1-6]>/gi,(W,X,Z)=>{let $=P(Z.replace(/<[^>]*>/g,""),V);return`<h${X} id="${$}"><a href="#${$}" class="heading-anchor">#</a>${Z}</h${X}>`})}function NQ(){return`
|
|
1162
|
+
.table-of-contents {
|
|
1163
|
+
position: sticky;
|
|
1164
|
+
top: 60px; /* Match navbar height */
|
|
1165
|
+
height: calc(100vh - 60px);
|
|
1166
|
+
width: 200px;
|
|
1167
|
+
overflow-y: auto;
|
|
1168
|
+
padding: 1rem;
|
|
1169
|
+
}
|
|
1170
|
+
|
|
1171
|
+
.toc-container {
|
|
1172
|
+
padding: 0;
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
.toc-title {
|
|
1176
|
+
margin: 0 0 1rem 0;
|
|
1177
|
+
font-size: 1.2rem;
|
|
1178
|
+
font-weight: 600;
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
.toc-list,
|
|
1182
|
+
.toc-sublist {
|
|
1183
|
+
list-style: none;
|
|
1184
|
+
padding: 0;
|
|
1185
|
+
margin: 0;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
.toc-list {
|
|
1189
|
+
padding-left: 0;
|
|
1190
|
+
}
|
|
1191
|
+
|
|
1192
|
+
.toc-sublist {
|
|
1193
|
+
padding-left: 1rem;
|
|
1194
|
+
margin-top: 0.5rem;
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
.toc-item,
|
|
1198
|
+
.toc-subitem {
|
|
1199
|
+
margin-bottom: 0.5rem;
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
.toc-link {
|
|
1203
|
+
color: inherit;
|
|
1204
|
+
text-decoration: none;
|
|
1205
|
+
display: block;
|
|
1206
|
+
padding: 0.25rem 0;
|
|
1207
|
+
border-radius: 0.25rem;
|
|
1208
|
+
transition: background-color 0.2s;
|
|
1209
|
+
}
|
|
1210
|
+
|
|
1211
|
+
.toc-link:hover {
|
|
1212
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
1213
|
+
}
|
|
1214
|
+
|
|
1215
|
+
.toc-active .toc-link,
|
|
1216
|
+
.active-toc-item .toc-link {
|
|
1217
|
+
background-color: rgba(0, 123, 255, 0.1);
|
|
1218
|
+
font-weight: 500;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
.toc-truncate {
|
|
1222
|
+
/* Styles for truncated TOC items */
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
.toc-truncate .toc-link {
|
|
1226
|
+
white-space: nowrap;
|
|
1227
|
+
overflow: hidden;
|
|
1228
|
+
text-overflow: ellipsis;
|
|
1229
|
+
}
|
|
1230
|
+
|
|
1231
|
+
.toc-collapse .toc-link::before {
|
|
1232
|
+
content: '\u25B6';
|
|
1233
|
+
margin-right: 0.5rem;
|
|
1234
|
+
transition: transform 0.2s;
|
|
1235
|
+
}
|
|
1236
|
+
|
|
1237
|
+
.toc-collapse.collapsed .toc-link::before {
|
|
1238
|
+
transform: rotate(90deg);
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1241
|
+
.toc-expand .toc-link::before {
|
|
1242
|
+
content: '\u25BC';
|
|
1243
|
+
margin-right: 0.5rem;
|
|
1244
|
+
}
|
|
1245
|
+
|
|
1246
|
+
.heading-anchor {
|
|
1247
|
+
color: inherit;
|
|
1248
|
+
text-decoration: none;
|
|
1249
|
+
opacity: 0;
|
|
1250
|
+
margin-left: -1rem;
|
|
1251
|
+
padding-right: 0.5rem;
|
|
1252
|
+
transition: opacity 0.2s;
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
h1:hover .heading-anchor,
|
|
1256
|
+
h2:hover .heading-anchor,
|
|
1257
|
+
h3:hover .heading-anchor,
|
|
1258
|
+
h4:hover .heading-anchor,
|
|
1259
|
+
h5:hover .heading-anchor,
|
|
1260
|
+
h6:hover .heading-anchor {
|
|
1261
|
+
opacity: 0.7;
|
|
1262
|
+
}
|
|
1263
|
+
|
|
1264
|
+
.heading-anchor:hover {
|
|
1265
|
+
opacity: 1;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
/* Smooth scrolling */
|
|
1269
|
+
html {
|
|
1270
|
+
scroll-behavior: smooth;
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
/* Responsive adjustments */
|
|
1274
|
+
@media (max-width: 768px) {
|
|
1275
|
+
.toc-sidebar {
|
|
1276
|
+
display: none;
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
.toc-floating {
|
|
1280
|
+
position: fixed;
|
|
1281
|
+
bottom: 1rem;
|
|
1282
|
+
right: 1rem;
|
|
1283
|
+
background: white;
|
|
1284
|
+
border: 1px solid #ddd;
|
|
1285
|
+
border-radius: 0.5rem;
|
|
1286
|
+
padding: 1rem;
|
|
1287
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
1288
|
+
max-width: 250px;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
`}function MQ(Q={}){let V=Q.smoothScroll!==!1,W=Q.activeHighlight!==!1,X=Q.collapsible!==!1;return`
|
|
1292
|
+
function initToc() {
|
|
1293
|
+
const tocLinks = document.querySelectorAll('.toc-link')
|
|
1294
|
+
|
|
1295
|
+
// Smooth scrolling for TOC links
|
|
1296
|
+
if (${String(V)}) tocLinks.forEach(link => {
|
|
1297
|
+
link.addEventListener('click', function(e) {
|
|
1298
|
+
e.preventDefault()
|
|
1299
|
+
const targetId = this.getAttribute('href')?.substring(1)
|
|
1300
|
+
const targetElement = document.getElementById(targetId)
|
|
1301
|
+
|
|
1302
|
+
if (targetElement) {
|
|
1303
|
+
targetElement.scrollIntoView({
|
|
1304
|
+
behavior: 'smooth',
|
|
1305
|
+
block: 'start'
|
|
1306
|
+
})
|
|
1307
|
+
|
|
1308
|
+
// Update URL without page reload
|
|
1309
|
+
history.pushState(null, '', \`#\${targetId}\`)
|
|
1310
|
+
}
|
|
1311
|
+
})
|
|
1312
|
+
})
|
|
1313
|
+
|
|
1314
|
+
// Active TOC item highlighting on scroll
|
|
1315
|
+
function updateActiveTocItem() {
|
|
1316
|
+
if (!${String(W)}) return
|
|
1317
|
+
const headings = document.querySelectorAll('h1, h2, h3, h4, h5, h6')
|
|
1318
|
+
const tocLinks = document.querySelectorAll('.toc-link')
|
|
1319
|
+
|
|
1320
|
+
let currentActive = null
|
|
1321
|
+
let currentDistance = Infinity
|
|
1322
|
+
|
|
1323
|
+
headings.forEach((heading, index) => {
|
|
1324
|
+
const rect = heading.getBoundingClientRect()
|
|
1325
|
+
const distance = Math.abs(rect.top)
|
|
1326
|
+
|
|
1327
|
+
if (distance < currentDistance && rect.top <= 100) {
|
|
1328
|
+
currentActive = heading.id
|
|
1329
|
+
currentDistance = distance
|
|
1330
|
+
}
|
|
1331
|
+
})
|
|
1332
|
+
|
|
1333
|
+
tocLinks.forEach(link => {
|
|
1334
|
+
const parent = link.parentElement
|
|
1335
|
+
if (parent) {
|
|
1336
|
+
parent.classList.remove('toc-active', 'active-toc-item')
|
|
1337
|
+
const href = link.getAttribute('href')?.substring(1)
|
|
1338
|
+
if (href === currentActive) {
|
|
1339
|
+
parent.classList.add('toc-active', 'active-toc-item')
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
})
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
// Throttle scroll events
|
|
1346
|
+
let scrollTimeout
|
|
1347
|
+
function throttledUpdate() {
|
|
1348
|
+
if (!scrollTimeout) {
|
|
1349
|
+
scrollTimeout = setTimeout(() => {
|
|
1350
|
+
updateActiveTocItem()
|
|
1351
|
+
scrollTimeout = null
|
|
1352
|
+
}, 100)
|
|
1353
|
+
}
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
window.addEventListener('scroll', throttledUpdate)
|
|
1357
|
+
updateActiveTocItem()
|
|
1358
|
+
|
|
1359
|
+
// TOC collapse/expand functionality
|
|
1360
|
+
const expandableItems = ${String(X)} ? document.querySelectorAll('.toc-expand') : []
|
|
1361
|
+
|
|
1362
|
+
expandableItems.forEach(item => {
|
|
1363
|
+
item.addEventListener('click', function(e) {
|
|
1364
|
+
if (e.target === this || e.target.closest('.toc-link')) {
|
|
1365
|
+
this.classList.toggle('collapsed')
|
|
1366
|
+
}
|
|
1367
|
+
})
|
|
1368
|
+
})
|
|
1369
|
+
|
|
1370
|
+
// Handle URL hash on page load
|
|
1371
|
+
if (window.location.hash) {
|
|
1372
|
+
const targetId = window.location.hash.substring(1)
|
|
1373
|
+
const targetElement = document.getElementById(targetId)
|
|
1374
|
+
|
|
1375
|
+
if (targetElement) {
|
|
1376
|
+
setTimeout(() => {
|
|
1377
|
+
targetElement.scrollIntoView({
|
|
1378
|
+
behavior: 'smooth',
|
|
1379
|
+
block: 'start'
|
|
1380
|
+
})
|
|
1381
|
+
}, 100)
|
|
1382
|
+
}
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
|
|
1386
|
+
// Initialize TOC when DOM is ready
|
|
1387
|
+
if (document.readyState === 'loading') {
|
|
1388
|
+
document.addEventListener('DOMContentLoaded', initToc)
|
|
1389
|
+
}
|
|
1390
|
+
else {
|
|
1391
|
+
initToc()
|
|
1392
|
+
}
|
|
1393
|
+
`}var{Glob:S,YAML:e}=globalThis.Bun;import{join as QQ}from"path";var DQ="/search-index.json",R={include:["**/*.md"],exclude:["public/**","**/node_modules/**"],searchFields:["title","content","headings","keywords"],maxResults:10,minQueryLength:1,fuzzy:!1,fuzziness:1,stemmer:"none",maxContentLength:800,boost:{title:10,headings:5,content:1}};function f(Q){let V=Q?.options??{};return{...R,...V,include:V.include??R.include,exclude:V.exclude??R.exclude,searchFields:V.searchFields??R.searchFields,maxResults:V.maxResults??Q?.maxResults??R.maxResults,boost:{...R.boost,...V.boost??{}}}}var x=[{key:"k",meta:!0,ctrl:!1,alt:!1,shift:!1},{key:"k",meta:!1,ctrl:!0,alt:!1,shift:!1},{key:"/",meta:!1,ctrl:!1,alt:!1,shift:!1}];function VQ(Q){if(!Q)return x;let V=(Array.isArray(Q)?Q:[Q]).map((Z)=>String(Z).toLowerCase()),W={meta:!1,ctrl:!1,alt:!1,shift:!1},X="";for(let Z of V)if(Z==="meta"||Z==="cmd"||Z==="command")W.meta=!0;else if(Z==="ctrl"||Z==="control")W.ctrl=!0;else if(Z==="alt"||Z==="option")W.alt=!0;else if(Z==="shift")W.shift=!0;else X=Z;if(!X)return x;return[{key:X,...W}]}function v(Q){if(typeof Q!=="function")return null;let V=Function.prototype.toString.call(Q);return V.includes("[native code]")?null:V}function OQ(Q,V){let W=Q?.search??Q?.markdown?.search,X=f(W),Z=W?.resultOptions??{};return{indexUrl:V,placeholder:W?.placeholder??"Search documentation",lazy:W?.lazy!==!1,maxResults:X.maxResults,minQueryLength:X.minQueryLength,searchFields:X.searchFields,boost:{title:X.boost.title??10,headings:X.boost.headings??5,content:X.boost.content??1},fuzzy:X.fuzzy,fuzziness:X.fuzziness,stemmer:X.stemmer,shortcuts:{keyboard:W?.keyboardShortcuts!==!1,keys:VQ(W?.shortcut)},result:{showDescription:Z.showDescription!==!1,descriptionLength:Z.descriptionLength??180,highlightMatches:Z.highlightMatches!==!1,showPath:Z.showPath!==!1},tokenizeSource:v(W?.options?.tokenize),onSearchSource:v(W?.onSearch),locale:null}}function k(Q){return w(Q).replace(/^:::.*$/gm," ").replace(/^\s{0,3}>\s*\[!(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]\s*$/gim," ").replace(/<[^>]+>/g," ").replace(/!\[[^\]]*\]\([^)]*\)/g," ").replace(/\[([^\]]*)\]\([^)]*\)/g,"$1").replace(/`([^`]+)`/g,"$1").replace(/[*_~]{1,3}([^*_~]+)[*_~]{1,3}/g,"$1").replace(/^\s{0,3}>\s?/gm,"").replace(/^\s*[-*+]\s+/gm,"").replace(/^\s*\d+\.\s+/gm,"").replace(/^\s*\|?[\s:|-]+\|[\s:|-]*$/gm," ").replace(/^\s{0,3}(?:-{3,}|\*{3,}|_{3,})\s*$/gm," ").replace(/\|/g," ").replace(/\s+/g," ").trim()}function WQ(Q){let V=Q.match(/^---\r?\n([\s\S]*?)\r?\n---\r?\n?/);if(!V)return{body:Q,data:{}};let W={};try{W=e.parse(V[1])??{}}catch{W={}}return{body:Q.slice(V[0].length),data:W}}function XQ(Q){let V=Q.replace(/\.md$/,"");if(V==="index")return"/";if(V.endsWith("/index"))return`/${V.slice(0,-6)}`;return`/${V}`}function ZQ(Q,V,W){let{body:X,data:Z}=WQ(V);if(Z.search===!1)return[];if(Z.layout==="home")return[];let $=typeof Z.search==="object"&&Z.search!==null?Z.search:{},j=Array.isArray($.keywords)?$.keywords.map(String):[],J=XQ(Q),Y=X.split(`
|
|
1394
|
+
`),q=X.match(/^#\s+(.+)$/m),G=$.title||Z.title||(q?q[1].trim():J),z=[],I=new Set,K={title:G,anchor:"",level:1,buffer:[]},M=()=>{let B=k(K.buffer.join(`
|
|
1395
|
+
`)).slice(0,W.maxContentLength);if(!B&&!K.title)return;let N={url:K.anchor?`${J}#${K.anchor}`:J,page:G,title:k(K.title)||G,text:B,level:K.level};if(j.length)N.keywords=j;z.push(N)},U=E();for(let B of Y){let N=U(B)?null:B.match(/^(#{1,6})\s+(.+?)\s*$/);if(!N){K.buffer.push(B);continue}let b=N[1].length,H=N[2].replace(/\s*\{#([\w-]+)\}\s*$/,""),F=N[2].match(/\{#([\w-]+)\}\s*$/),p=O(F?F[1]:D(y(H)),I);if(b===1){K.buffer.push("");continue}M(),K={title:H,anchor:p,level:b,buffer:[]}}return M(),z.filter((B)=>B.text||B.level>1)}function $Q(Q,V){let{storeFields:W}=V;if(!W||!W.length)return Q;let X=new Set(["url",...W]);if(V.searchFields.includes("title"))X.add("title");if(V.searchFields.includes("content"))X.add("text");if(V.searchFields.includes("headings"))X.add("page");if(V.searchFields.includes("keywords"))X.add("keywords");return Q.map((Z)=>{let $={};for(let[j,J]of Object.entries(Z))if(X.has(j)&&J!==void 0)$[j]=J;return $})}function T(Q){return Q.split("#")[0]}function jQ(Q,V){if(!V.enabled)return{locale:V.defaultLocale,page:Q};let W=Q.split("/");if(W.length>1&&V.locales.includes(W[0])&&W[0]!==V.defaultLocale)return{locale:W[0],page:W.slice(1).join("/")};let X=Q.match(/^(.*)\.([A-Za-z-]+)(\.md)$/);if(X&&V.locales.includes(X[2]))return{locale:X[2],page:`${X[1]}${X[3]}`};return{locale:V.defaultLocale,page:Q}}async function AQ(Q,V){let W=V?.search??V?.markdown?.search,X=f(W),Z=m(V),$=X.exclude.map((q)=>new S(q)),j=[],J=new Set,Y=new Map;for(let q of Z.locales)Y.set(q,new Set);for(let q of X.include){let G=new S(q);for await(let z of G.scan(Q)){let I=z.replace(/\\/g,"/");if(J.has(I))continue;if($.some((K)=>K.match(I)))continue;J.add(I);try{let K=await Bun.file(QQ(Q,I)).text(),{locale:M,page:U}=jQ(I,Z);for(let B of ZQ(U,K,X)){if(Z.enabled)B.locale=M,B.url=A(Z,M,B.url);j.push(B),Y.get(M)?.add(T(B.url))}}catch{}}}if(Z.enabled){let q=j.filter((G)=>G.locale===Z.defaultLocale);for(let G of Z.locales){if(G===Z.defaultLocale)continue;let z=Y.get(G)??new Set;for(let I of q){let K=A(Z,G,I.url);if(z.has(T(K)))continue;j.push({...I,url:K,locale:G})}}}return $Q(j,X)}
|
|
1396
|
+
export{h as A,g as B,d as C,YQ as D,w as E,KQ as F,s as G,y as H,D as I,O as J,P as K,a as L,i as M,o as N,_ as O,C as P,r as Q,n as R,t as S,zQ as T,BQ as U,IQ as V,NQ as W,MQ as X,DQ as Y,OQ as Z,AQ as _};
|
package/dist/src/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{
|
|
2
|
+
import{a as W,b as X,c as Y,d as Z,e as _,f as $,g as b,h as v,i as wj,j as zj,k as Bj,l as Dj,m as Ej,n as Gj}from"../chunk-kfbpnqaw.js";import{v as j,w as k,x as q,y as u,z as w}from"../chunk-qzhr4d2q.js";import{A as Q,B as S,C as T,D as V,G as y,H as p,I as f,J as c,K as d,L as g,M as a,N as n,O as o,P as r,Q as t,R as i,S as s,T as e,U as jj,V as kj,W as qj,X as uj,Y as z,Z as B,_ as D}from"../chunk-zkdm5pr7.js";import{aa as A,ba as F,ca as R,da as U,ea as m,fa as x,ga as C,ha as l,ia as h}from"../chunk-em1tv2bw.js";export{Bj as wrapInLayout,zj as stripConfiguredBasePath,Ej as startServer,R as splitLocaleFromPath,Gj as serveCLI,A as resolveI18nConfig,W as resetHighlighter,c as reserveUniqueSlug,jj as processInlineTocSyntax,b as prewarmHighlighter,X as normalizeLanguage,Dj as markdownToHtml,p as markdownHeadingText,U as localizeUrl,C as localeLabel,m as localeContentCandidates,F as loadI18nTranslations,Y as isLanguageSupported,_ as highlightCodeSync,Z as highlightCode,$ as getSyntaxHighlightingStyles,v as getHighlighterInstance,wj as getConfiguredBasePath,V as getConfig,d as generateUniqueSlug,qj as generateTocStyles,uj as generateTocScripts,e as generateTocPositions,o as generateTocHtml,s as generateTocData,f as generateSlug,w as generateSitemap,t as generateSidebarTocHtml,k as generateRssFeed,q as generateRobotsTxt,h as generateLocaleDetectionScript,r as generateInlineTocHtml,l as generateHreflangTags,i as generateFloatingTocHtml,n as filterHeadings,g as extractHeadings,kj as enhanceHeadingsWithAnchors,y as defaultTocConfig,Q as defaultConfig,x as configForLocale,T as config,a as buildTocHierarchy,u as buildSitemap,B as buildSearchRuntimeConfig,D as buildSearchIndex,j as buildRssFeed,S as applyConfigPlugins,z as SEARCH_INDEX_PATH};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Locating code regions in markdown.
|
|
3
|
+
*
|
|
4
|
+
* Every markdown extension BunPress adds — includes, code imports, containers,
|
|
5
|
+
* alerts, emoji, badges — is a plain-text pattern, which means a docs page that
|
|
6
|
+
* *demonstrates* one in a code block would otherwise have it executed instead
|
|
7
|
+
* of shown. This module is how the pipeline tells "code" from "prose".
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* A stateful predicate answering "is this line part of a fenced code block?",
|
|
11
|
+
* fence markers included. Feed it every line of a document in order.
|
|
12
|
+
*
|
|
13
|
+
* A regex pass over the whole file cannot do this: docs commonly wrap example
|
|
14
|
+
* markdown in a four-backtick fence containing three-backtick fences, and
|
|
15
|
+
* naive pairing desyncs on the first one. CommonMark's rule is that the
|
|
16
|
+
* closing fence uses the same character and is at least as long as the opener,
|
|
17
|
+
* which is what this tracks.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createFenceTracker(): (line: string) => boolean;
|
|
20
|
+
/** Remove fenced code blocks, fences included. */
|
|
21
|
+
export declare function stripFencedCode(markdown: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Hide fenced code blocks and inline code spans behind placeholders so a
|
|
24
|
+
* transform can run over prose without reaching into code examples.
|
|
25
|
+
*
|
|
26
|
+
* Restoring is a single pass: code regions are captured verbatim and can never
|
|
27
|
+
* themselves contain a placeholder, so there is nothing to recurse into.
|
|
28
|
+
*/
|
|
29
|
+
export declare function maskCodeRegions(markdown: string): MaskedCode;
|
|
30
|
+
/**
|
|
31
|
+
* Run a transform over `markdown` with code regions hidden.
|
|
32
|
+
*/
|
|
33
|
+
export declare function withCodeMasked(markdown: string, transform: (masked: string) => string | Promise<string>): Promise<string>;
|
|
34
|
+
export declare interface MaskedCode {
|
|
35
|
+
masked: string
|
|
36
|
+
restore: (content: string) => string
|
|
37
|
+
}
|
package/dist/src/toc.d.ts
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import type { TocConfig, TocData, TocHeading, TocPositionData } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Return the text a rendered Markdown heading exposes to the slugger.
|
|
4
|
+
*
|
|
5
|
+
* This intentionally does not reuse prose/list cleanup: a heading beginning
|
|
6
|
+
* with `1.` is numbered text, not an ordered-list marker.
|
|
7
|
+
*/
|
|
8
|
+
export declare function markdownHeadingText(markdown: string): string;
|
|
2
9
|
/**
|
|
3
10
|
* Generate a URL-safe slug from heading text
|
|
4
11
|
*/
|
|
5
12
|
export declare function generateSlug(text: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* Reserve a unique heading id from an already-normalized slug.
|
|
15
|
+
*
|
|
16
|
+
* Custom anchors and generated slugs share one namespace in the rendered
|
|
17
|
+
* document, so callers must reserve both through the same path.
|
|
18
|
+
*/
|
|
19
|
+
export declare function reserveUniqueSlug(slug: string, existingSlugs: Set<string>): string;
|
|
6
20
|
/**
|
|
7
21
|
* Generate unique slug for heading, handling duplicates
|
|
8
22
|
*/
|
package/package.json
CHANGED
package/dist/chunk-w615shtf.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import{$ as d,Y as a,Z as b,_ as c,aa as e,ba as f,ca as g,da as h,ea as i}from"./chunk-n0ebp7d8.js";export{c as splitLocaleFromPath,a as resolveI18nConfig,d as localizeUrl,g as localeLabel,e as localeContentCandidates,b as loadI18nTranslations,i as generateLocaleDetectionScript,h as generateHreflangTags,f as configForLocale};
|