367 | {section.title && (
368 |
369 | {section.title}
370 |
373 | {section.content.map((line, lineIndex) => {
374 | // Handle code blocks - detect full code blocks
375 | if (line.trim().startsWith('```')) {
376 | // If we find the start of a code block, collect all lines until the end
377 | if (line.trim() === '```' || line.trim().startsWith('```')) {
378 | // Find end of this code block
379 | const codeBlockEndIndex = section.content.findIndex(
380 | (l, i) => i > lineIndex && l.trim() === '```'
381 | );
382 |
383 | if (codeBlockEndIndex > lineIndex) {
384 | // Extract language if specified
385 | const langMatch = line.trim().match(/```(\w+)/);
386 | const language = langMatch ? langMatch[1] : '';
387 |
388 | // Get the code content
389 | const codeContent = section.content
390 | .slice(lineIndex + 1, codeBlockEndIndex)
391 | .join('\n');
392 |
393 | // Skip ahead in our loop
394 | lineIndex = codeBlockEndIndex;
395 |
396 | return (
397 |
398 | {codeContent}
399 |
400 | );
401 | }
402 | }
403 | }
404 |
405 | // Handle bullet points
406 | if (line.trim().match(/^[\-*•]\s/) || line.trim().match(/^\d+\.\s/)) {
407 | return (
408 |
409 |
410 |
411 | {line.replace(/^[\-*•]\s|^\d+\.\s/, '')}
412 |
413 |
414 | );
415 | }
416 |
417 | // Handle inline code
418 | if (line.includes('`')) {
419 | const parts = line.split(/(`[^`]+`)/g);
420 | return (
421 |
422 | {parts.map((part, partIndex) => {
423 | if (part.startsWith('`') && part.endsWith('`')) {
424 | return {part.slice(1, -1)};
425 | }
426 | return {part};
427 | })}
428 |
429 | );
430 | }
431 |
432 | // Handle sub-headers
433 | if (line.trim().match(/^#+\s/) || (line.trim().match(/^[A-Z][\w\s]+:/) && line.length < 60)) {
434 | return (
435 |
436 | {line.replace(/^#+\s+/, '')}
437 |
438 | );
439 | }
440 |
441 | // Regular text
442 | return
{line}
;
443 | })}
444 |