tag:support.markedapp.com,2011-09-11:/discussions/problems/107216-image-references-in-multi-file-documentsMarked: Discussion 2015-11-29T18:14:10Ztag:support.markedapp.com,2011-09-11:Comment/385748042015-11-29T18:14:09Z2015-11-29T18:14:09ZImage references in multi-file documents<div><p>You have to consider that when Marked compiles a document, it
has to<br>
concatenate all of the included files into one before rendering so
that<br>
things like footnotes and indexes across multiple docs will render
in<br>
Markdown. Thus, there's only one base for relative paths to work
off of.</p>
<p>It <em>could</em> rewrite the image paths in individual
documents when they're<br>
included, but then things become even more unpredictable for the
user,<br>
and things like HTML export will break if the directory structure
isn't<br>
modified.</p>
<p>The best way to insert an image that will work in both instances
is to<br>
use an absolute path, e.g.:</p>
<pre>
<code>![](/Users/username/Documents/project/images/image.png)</code>
</pre>
<p>This clearly makes the document less portable, though, as if
you<br>
move/rename the parent folder all of the images in the document
will<br>
break.</p>
<p>I currently do not have a better solution. It might be possible
to allow<br>
a "root folder" metadata variable in the index and rewrite
included<br>
paths based on that only when it's defined, but nothing like that
is<br>
currently implemented.</p>
<p>-Brett</p></div>Brett