Skip to content

Commit c1e57a2

Browse files
committed
under_score
1 parent 13e1cc5 commit c1e57a2

File tree

4 files changed

+30
-30
lines changed

4 files changed

+30
-30
lines changed

apps/svelte.dev/src/lib/server/content.ts

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ const assets = import.meta.glob<string>(
1919
}
2020
);
2121

22-
export const documentsContent = import.meta.glob<string>('../../../content/**/*.md', {
22+
export const documents_content = import.meta.glob<string>('../../../content/**/*.md', {
2323
eager: true,
2424
query: '?raw',
2525
import: 'default'
@@ -148,15 +148,15 @@ const DOCUMENTATION_NAMES: Record<string, string> = {
148148
cli: 'Svelte CLI'
149149
};
150150

151-
export function getDocumentationTitle(type: string): string {
151+
export function get_documentation_title(type: string): string {
152152
return `This is the developer documentation for ${DOCUMENTATION_NAMES[type]}.`;
153153
}
154154

155-
export function getDocumentationStartTitle(type: string): string {
155+
export function get_documentation_start_title(type: string): string {
156156
return `# Start of ${DOCUMENTATION_NAMES[type]} documentation`;
157157
}
158158

159-
export function filterDocsByPackage(
159+
export function filter_docs_by_package(
160160
allDocs: Record<string, string>,
161161
type: string
162162
): Record<string, string> {
@@ -189,7 +189,7 @@ const defaultOptions: MinimizeOptions = {
189189
normalizeWhitespace: false
190190
};
191191

192-
function removeQuoteBlocks(content: string, blockType: string): string {
192+
function remove_quote_blocks(content: string, blockType: string): string {
193193
return content
194194
.split('\n')
195195
.reduce((acc: string[], line: string, index: number, lines: string[]) => {
@@ -212,22 +212,22 @@ function removeQuoteBlocks(content: string, blockType: string): string {
212212
.join('\n');
213213
}
214214

215-
function minimizeContent(content: string, options?: Partial<MinimizeOptions>): string {
215+
function minimize_content(content: string, options?: Partial<MinimizeOptions>): string {
216216
// Merge with defaults, but only for properties that are defined
217217
const settings: MinimizeOptions = options ? { ...defaultOptions, ...options } : defaultOptions;
218218

219219
let minimized = content;
220220

221221
if (settings.removeLegacy) {
222-
minimized = removeQuoteBlocks(minimized, 'LEGACY');
222+
minimized = remove_quote_blocks(minimized, 'LEGACY');
223223
}
224224

225225
if (settings.removeNoteBlocks) {
226-
minimized = removeQuoteBlocks(minimized, 'NOTE');
226+
minimized = remove_quote_blocks(minimized, 'NOTE');
227227
}
228228

229229
if (settings.removeDetailsBlocks) {
230-
minimized = removeQuoteBlocks(minimized, 'DETAILS');
230+
minimized = remove_quote_blocks(minimized, 'DETAILS');
231231
}
232232

233233
if (settings.removePlaygroundLinks) {
@@ -251,7 +251,7 @@ function minimizeContent(content: string, options?: Partial<MinimizeOptions>): s
251251
return minimized;
252252
}
253253

254-
function shouldIncludeFileLlmDocs(filename: string, ignore: string[] = []): boolean {
254+
function should_include_file_llm_docs(filename: string, ignore: string[] = []): boolean {
255255
const shouldIgnore = ignore.some((pattern) => minimatch(filename, pattern));
256256
if (shouldIgnore) {
257257
if (dev) console.log(`❌ Ignored by pattern: ${filename}`);
@@ -268,7 +268,7 @@ interface GenerateLlmContentOptions {
268268
package?: string;
269269
}
270270

271-
export function generateLlmContent(
271+
export function generate_llm_content(
272272
docs: Record<string, string>,
273273
options: GenerateLlmContentOptions = {}
274274
): string {
@@ -280,10 +280,10 @@ export function generateLlmContent(
280280
}
281281

282282
let currentSection = '';
283-
const paths = sortDocumentationPaths(Object.keys(docs));
283+
const paths = sort_documentation_paths(Object.keys(docs));
284284

285285
for (const path of paths) {
286-
if (!shouldIncludeFileLlmDocs(path, ignore)) continue;
286+
if (!should_include_file_llm_docs(path, ignore)) continue;
287287

288288
// If a specific package is provided, only include its docs
289289
if (pkg) {
@@ -293,7 +293,7 @@ export function generateLlmContent(
293293
const docType = packages.find((p) => path.includes(`/docs/${p}/`));
294294
if (!docType) continue;
295295

296-
const section = getDocumentationStartTitle(docType);
296+
const section = get_documentation_start_title(docType);
297297
if (section !== currentSection) {
298298
if (currentSection) content += '\n';
299299
content += `${section}\n\n`;
@@ -302,26 +302,26 @@ export function generateLlmContent(
302302
}
303303

304304
content += `## ${path.replace('../../../content/', '')}\n\n`;
305-
const docContent = minimizeOptions ? minimizeContent(docs[path], minimizeOptions) : docs[path];
305+
const docContent = minimizeOptions ? minimize_content(docs[path], minimizeOptions) : docs[path];
306306
content += docContent;
307307
content += '\n';
308308
}
309309

310310
return content;
311311
}
312312

313-
function getDocumentationSectionPriority(path: string): number {
313+
function get_documentation_section_priority(path: string): number {
314314
if (path.includes('/docs/svelte/')) return 0;
315315
if (path.includes('/docs/kit/')) return 1;
316316
if (path.includes('/docs/cli/')) return 2;
317317
return 3;
318318
}
319319

320-
export function sortDocumentationPaths(paths: string[]): string[] {
320+
export function sort_documentation_paths(paths: string[]): string[] {
321321
return paths.sort((a, b) => {
322322
// First compare by section priority
323-
const priorityA = getDocumentationSectionPriority(a);
324-
const priorityB = getDocumentationSectionPriority(b);
323+
const priorityA = get_documentation_section_priority(a);
324+
const priorityB = get_documentation_section_priority(b);
325325
if (priorityA !== priorityB) return priorityA - priorityB;
326326

327327
// Get directory paths

apps/svelte.dev/src/routes/docs/[...path]/llms.txt/+server.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@ import type { RequestHandler } from './$types';
22
import type { EntryGenerator } from './$types';
33
import { error } from '@sveltejs/kit';
44
import {
5-
documentsContent,
6-
filterDocsByPackage,
7-
generateLlmContent,
8-
getDocumentationTitle,
5+
documents_content,
6+
filter_docs_by_package,
7+
generate_llm_content,
8+
get_documentation_title,
99
packages
1010
} from '$lib/server/content';
1111

@@ -22,14 +22,14 @@ export const GET: RequestHandler = async ({ params }) => {
2222
error(404, 'Not Found');
2323
}
2424

25-
const filteredDocs = filterDocsByPackage(documentsContent, packageType);
25+
const filteredDocs = filter_docs_by_package(documents_content, packageType);
2626

2727
if (Object.keys(filteredDocs).length === 0) {
2828
error(404, 'No documentation found for this package');
2929
}
3030

31-
const PREFIX = `<SYSTEM>${getDocumentationTitle(packageType)}</SYSTEM>`;
32-
const content = `${PREFIX}\n\n${generateLlmContent(filteredDocs)}`;
31+
const PREFIX = `<SYSTEM>${get_documentation_title(packageType)}</SYSTEM>`;
32+
const content = `${PREFIX}\n\n${generate_llm_content(filteredDocs)}`;
3333

3434
return new Response(content, {
3535
status: 200,

apps/svelte.dev/src/routes/llms-full.txt/+server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { RequestHandler } from './$types';
2-
import { documentsContent, generateLlmContent } from '$lib/server/content';
2+
import { documents_content, generate_llm_content } from '$lib/server/content';
33

44
const PREFIX =
55
'<SYSTEM>This is the full developer documentation for Svelte and SvelteKit.</SYSTEM>';
66

77
export const GET: RequestHandler = async () => {
8-
const content = `${PREFIX}\n\n${generateLlmContent(documentsContent)}`;
8+
const content = `${PREFIX}\n\n${generate_llm_content(documents_content)}`;
99

1010
return new Response(content, {
1111
status: 200,

apps/svelte.dev/src/routes/llms.txt/+server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import type { RequestHandler } from './$types';
2-
import { documentsContent, generateLlmContent } from '$lib/server/content';
2+
import { documents_content, generate_llm_content } from '$lib/server/content';
33

44
const PREFIX =
55
'<SYSTEM>This is the abridged developer documentation for Svelte and SvelteKit.</SYSTEM>';
66

77
export const GET: RequestHandler = async () => {
8-
const content = `${PREFIX}\n\n${generateLlmContent(documentsContent, {
8+
const content = `${PREFIX}\n\n${generate_llm_content(documents_content, {
99
ignore: [
1010
// Svelte ignores
1111
'../../../content/docs/svelte/07-misc/04-custom-elements.md',

0 commit comments

Comments
 (0)