tag:support.markedapp.com,2011-09-11:/discussions/questions/9169-multi-file-documents-in-different-foldersMarked: Discussion 2018-10-16T20:28:35Ztag:support.markedapp.com,2011-09-11:Comment/462383172018-10-10T20:10:42Z2018-10-11T00:57:45ZMulti-File Documents in different folders<div><p>I forgot, I tried mmd_merge because I wanted the indented header levels. Is that possible without the #merge syntax multi-file document?</p></div>Randy Walkertag:support.markedapp.com,2011-09-11:Comment/462383172018-10-10T20:38:14Z2018-10-10T20:38:14ZMulti-File Documents in different folders<div><p>If the paths to the images within the included files are relative paths,<br>
they have to be relative to the main index file. Thus, if your file were<br>
in "base" and your documents were in "base/files" and your images were<br>
in "base/images":</p>
<p>base<br>
|- index.md |- files/files1.md |- images/image1.jpg</p>
<p>The image reference in files/files1.md (when included in index.md) would<br>
need to be <img src="images/image1.jpg" alt="">, even though if that file were viewed<br>
directly, it would need to be <img src="../images/image1.jpg" alt="">.</p>
<p>When Marked merges all of the files, it's not rendering the Markdown<br>
until the merge is complete, for fairly obvious reasons (footnotes, for<br>
example, defined in a separate file, would never render, table of<br>
contents can't be generated until the document structure is complete,<br>
etc.). Thus, once it's all combined, the index file's location is the<br>
only reference point on disk for any relative image referenced in an<br>
included file. Everything acts as if it was referenced from the location<br>
of the index file. Does that make sense?</p>
<p>Also, mmd_merge is the only format that allows a structure/hierarchy to<br>
be specified, thus the only one that modifies header levels of included<br>
files.</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/462383172018-10-10T20:42:58Z2018-10-11T00:57:45ZMulti-File Documents in different folders<div><p>My images, are in a subfolder of files like files/images/image1.jpg</p>
<p>Does this make a difference?</p></div>Randy Walkertag:support.markedapp.com,2011-09-11:Comment/462383172018-10-10T20:50:23Z2018-10-10T20:50:23ZMulti-File Documents in different folders<div><p>It might be easiest if you drew out (or zipped up a sample) the<br>
structure, showing where the index file is in relation to the included<br>
files and the images.</p>
<p>Based on that example, and assuming the index is in the same folder as<br>
the "files" folder, the images would need to be referenced as<br>
<img src="files/images/image1.jpg" alt="">, whereas I'm assuming they currently just reference <img src="images/image1.jpg" alt="">.</p>
<p>Is there a specific reason you need to keep the Marked index document<br>
outside of the folder with the files? Putting it in the same folder<br>
would alleviate the need to have different paths, and as it is, it<br>
sounds like altering your paths would break images in whatever other app<br>
you're using with the same files.</p>
<p>-Brett</p></div>Bretttag:support.markedapp.com,2011-09-11:Comment/462383172018-10-10T21:04:27Z2018-10-11T00:57:45ZMulti-File Documents in different folders<div><p>I've attached a screenshot of what a sample project folder would look like.</p>
<p>I'd like to keep the Marked index file outside of the folder with all of the component documents for ease of use with the other tool that uses my markdown files. Right now, it's just one file but I imagine use cases where I'll have different index files including different subsets of the component files</p>
<p>currently referencing the images as <code>![](images/image1.jpg)</code> yes</p></div>Randy Walkertag:support.markedapp.com,2011-09-11:Comment/462383172018-10-10T23:54:19Z2018-10-10T23:54:19ZMulti-File Documents in different folders<div><p>Would it make a difference to your other tool if the index had an extension other than md? I usually name mine index.marked (any extension will work).</p>
<ul>
<li>Brett</li>
</ul></div>Bretttag:support.markedapp.com,2011-09-11:Comment/462383172018-10-11T00:57:10Z2018-10-11T00:57:45ZMulti-File Documents in different folders<div><p>Oooh, good call. The other tool only supports a few extensions so I could try this!</p></div>Randy Walkertag:support.markedapp.com,2011-09-11:Comment/462383172018-10-16T20:28:16Z2018-10-16T20:28:35ZMulti-File Documents in different folders<div><p>I don't know why I didn't think to mention this, but you could try setting an "include base" metadata key to specify the base directory your other files are in.</p>
<p>Add this at the top of the document (modified for your actual path names)</p>
<pre>
<code>Include Base: /Users/youruser/Documents/project/files</code>
</pre>
<p>That should alter the base directory that Marked is looking for included files from, so when an image is referenced with "images/image1.jpg", it should look for it in "files/images/image1.jpg". I can't guarantee this works, it's a bit fickle and I haven't tested in this case, but worth a shot if you're still figuring this out.</p></div>Brett