Process file includes relative to the file doing the include
I started a new project and decided to use a folder of Markdown documents with some folder hierarchy for sections and whatnot. Right now, it's pretty simple, but one thing I did notice was that all includes appear to be relative to the master document. I have something like this:
- Project root
- Project Document.md
- Introduction.md
- Section 1
- subsection1 file1.md file2.md *subsection2 file3.md file4.md *subsection3 file5.md file6.md
What I would like to do is include file4.md in file3.md with <<[file4.md]
but Marked only supports includes relative to the root file. One reason for this is the structure of my project means having a file with the same name in each section that I want to include in the section file, which then gets included in the main project file.
Keyboard shortcuts
Generic
? | Show this help |
---|---|
ESC | Blurs the current field |
Comment Form
r | Focus the comment reply box |
---|---|
^ + ↩ | Submit the comment |
You can use Command ⌘
instead of Control ^
on Mac
Support Staff 1 Posted by Brett on 15 Jul, 2012 03:54 PM
I'm afraid I don't understand the question. If you're talking about a directory structure, you can just use <<[subsection2/file4.md]. Due to the potential for infinite loops in recursive includes, there are some limitations, but that should work for you... am I missing something?
2 Posted by jamie on 16 Jul, 2012 01:11 PM
Well, Tender managed to munge my Markdown; imagine that.
If file3.md and file4.md are sibling files, I want to be able to include file4 in file3 without specifying the containing directory.
My feeling is this should basically correspond to
This is a tiny nit to be sure, but it was something I ran into quickly in trying to use Marked for the first time with a larger endeavor.
Support Staff 3 Posted by Brett on 18 Jul, 2012 03:19 PM
I'll look into this. I'm having trouble wrapping my head around any potential consequences right now, but I did make it recursive so I need to figure out the best way to handle base paths for nested includes. It makes sense that everything should be relative to the document containing the include, though. I'll play with it.