isRelativePath reports whether path is relative to a directory, and so can be placed inside the one the markdown was read from. filepath.IsAbs is not enough on Windows, where "\x" is rooted on the current drive and "C:x" names a drive of its own, though neither is absolute.
(path string)
| 394 | // enough on Windows, where "\x" is rooted on the current drive and "C:x" names |
| 395 | // a drive of its own, though neither is absolute. |
| 396 | func isRelativePath(path string) bool { |
| 397 | if path == "" || filepath.IsAbs(path) || filepath.VolumeName(path) != "" { |
| 398 | return false |
| 399 | } |
| 400 | return !os.IsPathSeparator(path[0]) |
| 401 | } |
| 402 | |
| 403 | // isRemoteDestination reports whether a destination addresses somewhere other |
| 404 | // than the filesystem, so that an attached file is never confused with a URI. |
no outgoing calls