# Trying to link to local files

#### Bob

21 Oct, 2011 02:35 PM

If I turn web sharing on and put a file (say a jpg) in anywhere under Sites Marked can open it.

If I use a relative or absolute path of the form file:///Users/Me/Folder/file.jpg I get "Marked failed to render the following document".

I'm using syntax here: here's my picture

Can some please help me out? I'm preparing lecture notes and I want the pictures at the end of the document or externally (but not inline), maybe I should be doing something else?

1. Posted by Bob on 21 Oct, 2011 02:38 PM

whoops, didn't realize that would make a link in above, here's my picture should be the actual syntax I used

[here's my picture](file:///Users/Me/Folder/file.jpg)

2. Support Staff Posted by Brett on 21 Oct, 2011 02:41 PM

Do you want the pictures to appear in the document, or just be linked? If they are to appear in the document, you need to use ![alt text](image path) (with the exclamation point). If you just want to link them, you should be able to do so with the syntax you're using, but Marked will probably not open the links internally, as they link to raw image files and Marked will reject anything it can't recognize as plain text. Let me know if that helps.

3. Posted by Bob on 21 Oct, 2011 02:58 PM

On Fri, Oct 21, 2011 at 10:41, Brett <
[email blocked]> wrote:

>
>

Thanks, you are correct. If I save my file as html and open it in Chrome the
“file://“ link does work. However, if I save as a PDF the links appear
highlighted but the PDF does not preserve the links. Is preserving links in
a pdf possible?

4. Support Staff Posted by Brett on 21 Oct, 2011 03:00 PM

How are you generating the PDF (Save as PDF, or Print->PDF)?

5. Posted by Bob on 21 Oct, 2011 03:04 PM

On Fri, Oct 21, 2011 at 11:00, Brett <
[email blocked]> wrote:

>
>

Save as PDF from the “gear” in the lower right of the preview window.

BTW of the suggestions you made below, is one more than the other “best” for
use with latex?

6. Support Staff Posted by Brett on 21 Oct, 2011 03:09 PM

If you use Print... and then select from the PDF option in the lower left of the dialog, it will preserve links and give you paginated output.

I honestly don't know much about LaTeX, really, and there's no specific document output for latex conversion.

-Brett

7. Posted by Bob on 21 Oct, 2011 03:15 PM

On Fri, Oct 21, 2011 at 11:09, Brett <
[email blocked]> wrote:

>
>

Latex: thanks

PDF links: tried lower left box as both “save as pdf” and “open in preview”:

8. Support Staff Posted by Brett on 21 Oct, 2011 03:19 PM

Are you certain? There's an option to remove link highlighting when printing, make sure that's off. Even with it on, the links should remain (just not visibly highlighted).

9. Posted by Bob on 21 Oct, 2011 04:08 PM

On Fri, Oct 21, 2011 at 11:19, Brett <
[email blocked]> wrote:

>
>

I checked that is not highlighted. I also quit marked and re-tried the
entire process. ?

10. Support Staff Posted by Brett on 21 Oct, 2011 05:33 PM

What type of printer do you have set up on your machine? In rare cases the type of printer can affect the Print as PDF output.

Can you post a sample document for me with the types of links you're trying to print? I'd like to test locally if possible.

11. Support Staff Posted by Brett on 21 Oct, 2011 05:38 PM

Nevermind, I figured out what's going on. No, you can't save local image links in a PDF, apparently. You should be able to host the files on Dropbox or similar and use remote links (http://) to preserve the links in PDF output.

12. Posted by Bob on 21 Oct, 2011 05:40 PM

On Fri, Oct 21, 2011 at 13:38, Brett <
[email blocked]> wrote:

>
>

see sample I emailed, on all but one I believe I am doing this?

13. Support Staff Posted by Brett on 21 Oct, 2011 05:42 PM

I just got your test file and apparently I'm wrong again. While links to documents are preserved, no image links appear to make it into the PDF.

I tested outputting the HTML (the links work) and saving a PDF from Safari (image links break). I don't know offhand why this happens, but it appears to be an issue with webkit in general. I don't have an immediate solution, I'm afraid.

14. Posted by Bob on 21 Oct, 2011 09:11 PM

Thanks for all your help. It is no big deal and mmdComposer is now available, it has a couple of export options that can accomplish this if required.

15. Support Staff Posted by Brett on 21 Oct, 2011 09:15 PM

MMD Composer also works well in tandem with Marked, I hope you find the combination suits your purposes well!

16. Posted by Bob on 21 Oct, 2011 09:19 PM

On Fri, Oct 21, 2011 at 17:15, Brett <
[email blocked]> wrote:

>
>

Oh both for sure! They play nice together, and you can set Marked as the
default preview for mmdComposer.

17. Posted by Gilles on 16 Feb, 2015 03:33 AM

Going back to the topics of links to local files, I noticed that they don't work if the path contains directory names with spaces.
Anybody else having the same problem?

18. Support Staff Posted by Brett on 16 Feb, 2015 03:34 AM

It's HTML, paths don't work with spaces. You have to use %20 instead of
a space. This is standard for any Markdown, have you seen it work
differently elsewhere?

19. Posted by Gilles on 16 Feb, 2015 04:52 AM

Thanks, it works fine.
I use Markdown in ipython notebooks where spaces in path are handled automatically. Since the idea of Markdown is to not have to write HTML, this approach felt so natural I never gave it a second thought.

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

### »

#### Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

# Keyboard shortcuts

### Generic

? Show this help Blurs the current field

### Comment Form

r Focus the comment reply box Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

## Recent Discussions

 21 Feb, 2020 11:32 PM Option to use MathJax 3? 20 Feb, 2020 03:12 PM Regular crashes 13 Feb, 2020 09:22 PM Markdown Formatting 11 Feb, 2020 11:53 AM Custom themes not working 10 Feb, 2020 06:48 PM KaTex Preview Update

## Recent Articles

 Using JavaScript in Marked Custom CSS: Writing custom CSS for Marked License code has already been utilized Highlight sentences longer than a certain number of words How do I retrieve a lost license (direct version)