fix: doc rendering — markdown prose styling, code blocks with copy button, proper step parsing
- Add @tailwindcss/typography plugin for prose styling - Create CodeBlock component with copy button and language labels - Create Md wrapper component using ReactMarkdown with custom renderers - Replace all plain text renders with Md for proper markdown formatting - Fix parseSteps() in pipeline to group numbered steps with code blocks - Add First Task subtitle explaining its purpose - Add conditional file.purpose render in module key files
This commit is contained in:
@@ -23,6 +23,29 @@ function parseList(text: string): string[] {
|
||||
.filter(Boolean);
|
||||
}
|
||||
|
||||
function parseSteps(text: string): string[] {
|
||||
const lines = text.split("\n");
|
||||
const steps: string[] = [];
|
||||
let current = "";
|
||||
|
||||
for (const line of lines) {
|
||||
if (/^\d+\.\s/.test(line)) {
|
||||
if (current.trim()) {
|
||||
steps.push(current.trim());
|
||||
}
|
||||
current = line.replace(/^\d+\.\s*/, "");
|
||||
} else {
|
||||
current += "\n" + line;
|
||||
}
|
||||
}
|
||||
|
||||
if (current.trim()) {
|
||||
steps.push(current.trim());
|
||||
}
|
||||
|
||||
return steps.filter(Boolean);
|
||||
}
|
||||
|
||||
export async function generateDocumentation(
|
||||
codeStructure: CodeStructure,
|
||||
provider: LLMProvider,
|
||||
@@ -112,7 +135,7 @@ export async function generateDocumentation(
|
||||
const gsResponse = await provider.chat(gsMessages);
|
||||
|
||||
const prerequisites = parseList(parseSection(gsResponse, "Prerequisites"));
|
||||
const setupSteps = parseList(parseSection(gsResponse, "Setup Steps"));
|
||||
const setupSteps = parseSteps(parseSection(gsResponse, "Setup Steps"));
|
||||
const firstTask = parseSection(gsResponse, "Your First Task");
|
||||
|
||||
onProgress?.("complete", 100);
|
||||
|
||||
Reference in New Issue
Block a user