From eda9b5dd2dc9c7e5531cc5706b77f43b41beac70 Mon Sep 17 00:00:00 2001 From: leohhhn Date: Mon, 12 Feb 2024 19:38:16 +0100 Subject: [PATCH] fix --- gnoblog-cli/cmd/util.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gnoblog-cli/cmd/util.go b/gnoblog-cli/cmd/util.go index 6ed28ca1..d923ba0e 100644 --- a/gnoblog-cli/cmd/util.go +++ b/gnoblog-cli/cmd/util.go @@ -19,7 +19,7 @@ func parsePost(reader io.Reader) (*post, error) { } p.Title, err = extractTitle(p.Body) - p.Body = removeTitle(p.Body, p.Title) + p.Body = removeTitle(string(rest), p.Title) p.Tags = removeWhitespace(p.Tags) if p.PublicationDate == nil { @@ -52,7 +52,7 @@ func extractTitle(body string) (string, error) { return "", fmt.Errorf("no H1 header found") } -// removeTitle removes the first occurrence of a H1 (Title) from the body of the post +// removeTitle removes the first occurrence of the Title from the body of the post func removeTitle(body, title string) string { t := "# " + title + "\n" return strings.Replace(body, t, "", 1)