Trying to link to local files

Bob's Avatar

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. 1 Posted by Bob on 21 Oct, 2011 02:38 PM

    Bob's Avatar

    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 2 Posted by Brett on 21 Oct, 2011 02:41 PM

    Brett's Avatar

    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. 3 Posted by Bob on 21 Oct, 2011 02:58 PM

    Bob's Avatar

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

    >
    > // Please reply above this line
    >

    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 4 Posted by Brett on 21 Oct, 2011 03:00 PM

    Brett's Avatar

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

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

    Bob's Avatar

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

    >
    > // Please reply above this line
    >

    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 6 Posted by Brett on 21 Oct, 2011 03:09 PM

    Brett's Avatar

    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. 7 Posted by Bob on 21 Oct, 2011 03:15 PM

    Bob's Avatar

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

    >
    > // Please reply above this line
    >

    Latex: thanks

    PDF links: tried lower left box as both “save as pdf” and “open in preview”:
    neither way preserved the links?

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

    Brett's Avatar

    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. 9 Posted by Bob on 21 Oct, 2011 04:08 PM

    Bob's Avatar

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

    >
    > // Please reply above this line
    >

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

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

    Brett's Avatar

    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 11 Posted by Brett on 21 Oct, 2011 05:38 PM

    Brett's Avatar

    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. 12 Posted by Bob on 21 Oct, 2011 05:40 PM

    Bob's Avatar

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

    >
    > // Please reply above this line
    >

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

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

    Brett's Avatar

    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. 14 Posted by Bob on 21 Oct, 2011 09:11 PM

    Bob's Avatar

    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 15 Posted by Brett on 21 Oct, 2011 09:15 PM

    Brett's Avatar

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

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

    Bob's Avatar

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

    >
    > // Please reply above this line
    >

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

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

    Gilles's Avatar

    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 18 Posted by Brett on 16 Feb, 2015 03:34 AM

    Brett's Avatar

    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. 19 Posted by Gilles on 16 Feb, 2015 04:52 AM

    Gilles's Avatar

    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.

Reply to this discussion

Internal reply

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

Attaching KB article:

»

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
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