replace \r\n with \n, fix #42

This commit is contained in:
Egor Kovetskiy
2021-11-08 20:15:59 +06:00
parent f3ba7c57a3
commit 1bd022b065
4 changed files with 17 additions and 3 deletions

View File

@@ -45,6 +45,12 @@ func LoadTemplate(
return nil, err
}
body = bytes.ReplaceAll(
body,
[]byte("\r\n"),
[]byte("\n"),
)
templates, err = templates.New(name).Parse(string(body))
if err != nil {
err = facts.Format(

View File

@@ -85,6 +85,12 @@ func resolveLink(
return "", karma.Format(err, "read file: %s", filepath)
}
linkContents = bytes.ReplaceAll(
linkContents,
[]byte("\r\n"),
[]byte("\n"),
)
// This helps to determine if found link points to file that's
// not markdown or have mark required metadata
linkMeta, _, err := ExtractMeta(linkContents)