package main import ( "bufio" "strings" ) func titleFromMarkup(markup string) string { scanner := bufio.NewScanner(strings.NewReader(markup)) for scanner.Scan() { line := scanner.Text() cut, found := strings.CutPrefix(line, "# ") if found { return cut } } return "no title detected" }