MCPcopy Create free account
hub / github.com/betta-tech/byo-coding-agent / firstParagraph

Function firstParagraph

cmd/sitegen/main.go:616–642  ·  view source on GitHub ↗

firstParagraph returns the first non-empty paragraph of body as plain text, dropping a leading "Goal:" / "Objetivo:" label if present. Used as the guide blurb on the landing page.

(body string)

Source from the content-addressed store, hash-verified

614// text, dropping a leading "Goal:" / "Objetivo:" label if present. Used
615// as the guide blurb on the landing page.
616func firstParagraph(body string) string {
617 var b strings.Builder
618 for _, line := range strings.Split(body, "\n") {
619 trim := strings.TrimSpace(line)
620 if trim == "" {
621 if b.Len() > 0 {
622 break
623 }
624 continue
625 }
626 if strings.HasPrefix(trim, "#") {
627 continue
628 }
629 if b.Len() > 0 {
630 b.WriteByte(' ')
631 }
632 b.WriteString(trim)
633 }
634 out := b.String()
635 for _, prefix := range []string{"Goal:", "Objetivo:"} {
636 if strings.HasPrefix(out, prefix) {
637 out = strings.TrimSpace(out[len(prefix):])
638 break
639 }
640 }
641 return out
642}
643
644func renderChapter(path, name, lang string, md goldmark.Markdown) (chapter, error) {
645 raw, err := os.ReadFile(path)

Callers 2

renderGuideFunction · 0.85
exerciseBlurbFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected