Skip to content

Commit d18ef2f

Browse files
Rich Glazermanclaude
authored andcommitted
chore: fix prettier formatting in plugin-llm-docs.ts
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 97c1ae3 commit d18ef2f

1 file changed

Lines changed: 12 additions & 25 deletions

File tree

docs-viewer/src/plugin-llm-docs.ts

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -188,16 +188,14 @@ function cleanMarkdownForLLM(content: string): string {
188188
/^:::\s*(tip|info|warning|danger|details)\s*([^\n]*)\n([\s\S]*?)^:::\s*$/gm,
189189
(_match, type: string, rawTitle: string, body: string) => {
190190
const title = rawTitle.trim();
191-
const label = title
192-
? `**[${type.toUpperCase()}: ${title}]**`
193-
: `**[${type.toUpperCase()}]**`;
191+
const label = title ? `**[${type.toUpperCase()}: ${title}]**` : `**[${type.toUpperCase()}]**`;
194192
const quotedBody = body
195193
.trim()
196194
.split('\n')
197195
.map((line) => `> ${line}`)
198196
.join('\n');
199197
return `${label}\n${quotedBody}`;
200-
},
198+
}
201199
)
202200
// ::: code-group — strip the marker, content is preserved verbatim
203201
.replace(/^::: code-group\s*$/gm, '')
@@ -232,14 +230,12 @@ function deriveTitle(relativePath: string): string {
232230
}
233231

234232
function toTitleCase(str: string): string {
235-
return str
236-
.replace(/[-_]/g, ' ')
237-
.replace(/\b\w/g, (c) => c.toUpperCase());
233+
return str.replace(/[-_]/g, ' ').replace(/\b\w/g, (c) => c.toUpperCase());
238234
}
239235

240236
async function collectLLMPages(srcDir: string): Promise<PageEntry[]> {
241237
const files = (globSync('**/*.md', { cwd: srcDir }) as string[]).filter(
242-
(f) => !f.startsWith('node_modules') && !f.startsWith('.vitepress'),
238+
(f) => !f.startsWith('node_modules') && !f.startsWith('.vitepress')
243239
);
244240

245241
const pages: PageEntry[] = [];
@@ -341,12 +337,7 @@ function formatEntry(entry: PageEntry): string {
341337
return lines.join('\n');
342338
}
343339

344-
function buildCategoryFile(
345-
status: LLMStatus,
346-
pages: PageEntry[],
347-
preamble: string,
348-
siteTitle: string,
349-
): string {
340+
function buildCategoryFile(status: LLMStatus, pages: PageEntry[], preamble: string, siteTitle: string): string {
350341
const matching = pages.filter((p) => p.llm.status === status);
351342
if (matching.length === 0) return '';
352343

@@ -361,11 +352,7 @@ function buildCategoryFile(
361352
].join('\n');
362353
}
363354

364-
function buildCombinedFile(
365-
pages: PageEntry[],
366-
preamble: string,
367-
siteTitle: string,
368-
): string {
355+
function buildCombinedFile(pages: PageEntry[], preamble: string, siteTitle: string): string {
369356
if (pages.length === 0) return '';
370357

371358
/**
@@ -388,9 +375,10 @@ function buildCombinedFile(
388375
];
389376

390377
const byStatus = Object.fromEntries(
391-
(['recommended', 'deprecated', 'discouraged'] as LLMStatus[]).map(
392-
(s) => [s, pages.filter((p) => p.llm.status === s)],
393-
),
378+
(['recommended', 'deprecated', 'discouraged'] as LLMStatus[]).map((s) => [
379+
s,
380+
pages.filter((p) => p.llm.status === s),
381+
])
394382
) as Record<LLMStatus, PageEntry[]>;
395383

396384
const lines: string[] = [
@@ -451,8 +439,7 @@ export function warpDriveLLMDocs(options: LLMDocsOptions = {}): Plugin {
451439

452440
// VitePress attaches its own config object to the Vite config under
453441
// the `vitepress` key. Fall back to standard Vite values when not found.
454-
const vp = (config as unknown as { vitepress?: { srcDir: string; outDir: string; title?: string } })
455-
.vitepress;
442+
const vp = (config as unknown as { vitepress?: { srcDir: string; outDir: string; title?: string } }).vitepress;
456443

457444
srcDir = options.srcDir ?? vp?.srcDir ?? config.root;
458445
outDir = vp?.outDir ?? config.build.outDir;
@@ -497,7 +484,7 @@ export function warpDriveLLMDocs(options: LLMDocsOptions = {}): Plugin {
497484

498485
// Summary log
499486
const statusCounts = (['recommended', 'deprecated', 'discouraged'] as LLMStatus[]).map(
500-
(s) => `${s}: ${pages.filter((p) => p.llm.status === s).length}`,
487+
(s) => `${s}: ${pages.filter((p) => p.llm.status === s).length}`
501488
);
502489
console.log(` ${'\x1b[34m'}llm-docs${'\x1b[0m'} generated — ${statusCounts.join(', ')}`);
503490
},

0 commit comments

Comments
 (0)