blob: c0a6d457757b5758e510103ac8088c12701bb9b6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
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"
}
|