| 546 | } |
| 547 | |
| 548 | export const buildPostMarkdown = ({ |
| 549 | post, |
| 550 | comments, |
| 551 | similarPosts, |
| 552 | }: PostMarkdownInput): string => { |
| 553 | const title = post.title || post.sharedPost?.title || 'Untitled'; |
| 554 | |
| 555 | const lines = [ |
| 556 | ...buildFrontmatter(post), |
| 557 | '', |
| 558 | '> ## Documentation Index', |
| 559 | `> Fetch the complete documentation index at: ${getLlmsTxtUrl()}`, |
| 560 | '> Use this file to discover all available pages before exploring further.', |
| 561 | '', |
| 562 | `# ${title}`, |
| 563 | '', |
| 564 | buildByline(post), |
| 565 | '', |
| 566 | ...buildSummary(post), |
| 567 | ...buildBody(post), |
| 568 | '', |
| 569 | ...buildAnsweredQuestions(post), |
| 570 | ...buildCommunityTake(post), |
| 571 | ...buildComments(comments), |
| 572 | ...buildSimilarPosts(similarPosts), |
| 573 | ...buildFooter(post), |
| 574 | ]; |
| 575 | |
| 576 | return `${lines.join('\n').replace(/\n{3,}/g, '\n\n')}\n`; |
| 577 | }; |