I’ve just started implementing this… but have come to the conclusion that
href is to loaded a term. It’s used for all sorts of URL links, not just file system paths. Instead I think I’m going to follow @macdrifter’s original advice and follow Plaintasks lead with a few less constraints (until I guess I learn why the constrains where there in the first place). Here’s the regex that I’m using right now and it seems to work well in my files:
It basically says:
- Anything that starts with
./ is a path.
- The path continues until a space is encountered.
- If your path does have a space use
\ to escape it.
So with that in mind paths look pretty much how they look in the terminal. We get support for both relative and absolute paths. When you drag and drop a path onto TaskPaper it will automatically create a link.
Plaintasks seems to also require that the path has a trailing
/. I guess that’s to avoid false positives? Or Make it easier to have paths with spaces? But it comes at the expense of having the path not really look like a real path. So for now I’m going to go with my more relaxed recognizer, but I’ll consider changing it in the future if it turns out to give to many false positives.
Also I’ll keep support for
file:/// paths, but I’m changing them back to always being absolute. So if you want a relative path you’ll (in next release) need to start with