-
Notifications
You must be signed in to change notification settings - Fork 1
Templates
githubber edited this page Feb 3, 2025
·
2 revisions
Placeholder and WIP docs for new template idea.
The placeholder docs are default topics and collections that are able to be imported from the Settings page.
src/lib/templates/official-docs.ts
Incorporating this content can serve as in-built onboarding guides.
// The different kinds of templates we'll support
export type TemplateType = 'official-docs' | 'starter-template' | 'community-template' | 'custom';
// Information about who created the template
export interface TemplateAuthor {
name: string;
url?: string; // Optional link to author's website/profile
}
// A single piece of content within a template
export interface TemplateTopic {
name: string;
description: string;
content: string;
order?: number; // Optional ordering within a collection
}
// A group of related topics
export interface TemplateCollection {
name: string;
description: string;
topics: TemplateTopic[];
}
// The main template interface that brings it all together
export interface Template {
id: string;
type: TemplateType;
name: string;
description: string;
version: string;
author: TemplateAuthor;
collections: TemplateCollection[];
created: string;
updated: string;
tags?: string[]; // Optional categorization
requiresVersion?: string; // Optional minimum Bebop version
}
// API response when importing a template
export interface TemplateImportResponse {
success: boolean;
message: string;
collections?: {
id: string;
name: string;
}[];
topics?: {
id: string;
name: string;
}[];
error?: string;
}
// API response when listing available templates
export interface TemplateListResponse {
templates: Template[];
total: number;
page: number;
pageSize: number;
}
Example usage:
// Example of how a template would be structured
const bebopDocsTemplate: Template = {
id: "bebop-docs-v1",
type: "official-docs",
name: "Bebop Documentation",
description: "Official Bebop user guide and documentation",
version: "1.0.0",
author: {
name: "Bebop Team",
url: "https://bebop.dev"
},
collections: [{
name: "Getting Started Guide",
description: "Learn how to use Bebop",
topics: [{
name: "Welcome to Bebop",
description: "Introduction and overview",
content: "# Welcome to Bebop\n...",
order: 1
}]
}],
created: "2024-02-02T00:00:00Z",
updated: "2024-02-02T00:00:00Z",
tags: ["documentation", "getting-started"],
requiresVersion: "0.2.0"
};
This type system gives us:
Clear structure for templates Type safety throughout the application Future extensibility for the marketplace Proper API response typing Version control capabilities