Document posts.ExtractTitle func
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
// ExtractTitle takes the given raw post text and returns a title, if explicitly
|
||||
// provided, and a body.
|
||||
func ExtractTitle(content string) (title string, body string) {
|
||||
if hashIndex := strings.Index(content, "# "); hashIndex == 0 {
|
||||
eol := strings.IndexRune(content, '\n')
|
||||
|
||||
Reference in New Issue
Block a user