ReadMarkdownBodyFile reads Markdown from path and returns its base directory for resolving local attachment references. Standard input has no base directory.
(path string, stdin io.ReadCloser)
| 20 | // for resolving local attachment references. Standard input has no base |
| 21 | // directory. |
| 22 | func ReadMarkdownBodyFile(path string, stdin io.ReadCloser) (content, dir string, err error) { |
| 23 | b, err := ReadFile(path, stdin) |
| 24 | if err != nil { |
| 25 | return "", "", err |
| 26 | } |
| 27 | if path != "-" { |
| 28 | dir = filepath.Dir(path) |
| 29 | } |
| 30 | return string(b), dir, nil |
| 31 | } |