Problem linking to local files in the same folder in exported HTML

David Magnuson

17 Apr, 2019 04:14 AM

// Please enter a detailed description of the issue // Description of the issue:

I have a Markdown file in which I am trying to link to other files in the same folder. I use relative links in the reference (e.g. [1]: ./MyFile.pdf)

• If I open the file in Marked2, the links work.

• If I export the file to HTML (in the same folder), the links no longer work.

• If I instead copy the HTML source using Shift-Cmd-C, save that text to an HTML file, and open it in a browser, the links work (but the text is not styled).

• When I open the styled HTML file and use Copy link over one of the non-working links, the pasted path is missing the lowest level of folder. In other words, it's as if the reference were [1]: ../MyFile.pdf rather than [1]: ./MyFile.pdf.

Is this a bug or am I missing something?

Also, a second issue: using the keystroke Shift-Cmd-E brings up the export panel at the bottom of the window; however, using the (supposedly equivalent) Export… menu selection under the File menu does nothing.

// Please enter a list of steps required to reproduce the issue // Steps to reproduce:

// If applicable please attach a sample document that causes the issue for you.

// Configuration (do not edit) Marked 2 972 (Direct)

macOS Version: 10.14.4

allowPageBreakInCode: YES
bookTxtIsLeanpub: NO
summaryMdIsGitBook: NO
codeIsPoetry: NO
codeCanWrap: YES
convertGithubCheckboxes: YES
convertYAMLToMMD: NO
defaultMathJaxConfig: TeX-AMS-MML_HTMLorMML
defaultPreviewStyle: 3
defaultProcessor: MultiMarkdown
enableMiniMap: YES
excludeBlockQuotesFromCounts: NO
excludeFootnotesFromCounts: NO
excludeVerbatimFromCounts: NO
excludeCaptionsFromCounts: NO
folderPreviewExtensionsArray: md, markdown, txt, mdown, html, opml
githubNewlines: NO
h1IsPageBreak: NO
h2IsPageBreak: NO
hrIsPageBreak: NO
includeMathJax: NO
includeKatex: NO
limitTextWidth: NO
minimalJavaScript: NO
outlineModeExtensions:
permissionGranted: NO
printFooterFirstPage: NO
processHTMLFiles: YES
scrollToEdit: YES
shouldDetectCritic: YES
shouldHighlightMarkupErrors: YES
syntaxHighlight: NO
syntaxHighlightOnlyLang: NO
useCustomMarkdownProcessor: NO
customMarkdownProcessor:
useCustomPreprocessor: NO
customPreprocessor:
useFirstH1AsPrintTitle: YES

1. Support Staff Posted by Brett on 17 Apr, 2019 04:46 PM

I'm not able to replicate this using the information provided. Could you create an example and attach both the source markdown and the exported HTML versions? Every version I've tested so far has included the correct path in the HTML output. Thanks!

2. Support Staff Posted by Brett on 17 Apr, 2019 05:00 PM

Regarding the Export... menu item, tracked that bug down and fixed for next update. Thanks for reporting.

3. Posted by David Magnuson on 17 Apr, 2019 08:18 PM

Hello Brett...

Thanks for your response. I've attached the files as requested.

The Markdown file references two pdfs in the same folder

- EN-05-10070.pdf
- InnovativeSocialSecurityNov2012.pdf

I've attached dummy versions of these to save space.

1. When I open (a) in Marked 2 and click on the link (the reference
number), Marked 2 presents a dialog asking if I want to open the file in
Preview, and if I accept, the file is opened.
2. (b) results from the *Save as HTML* command, and is saved to the same
folder. When I open the HTML in a browser and click the link, nothing
happens. I happen to use Github style, but changing styles didn't correct
matters.
3. (c) results from using the *Copy HTML Source* command, pasting to a
text editor, and saving. When this is opened in a browser, the link works
and the pdf is opened in the browser window.
4. If I open (b), hover over the first link, and use *Copy Link*, the
result is
file:///Files/Magnuson/CloudSync/OneDrive/Reference/Year/2019/EN-05-10070.pdf
5. If I open (c) and do the same thing, the result is
file:///Files/Magnuson/CloudSync/OneDrive/Reference/Year/2019/Social%20Security/EN-05-10070.pdf

So it seems that the link in (b) omits the immediate folder (*Social
Security*) from the path. The link doesn't work because it points to the
wrong folder.

Hope this provides enough to figure what's going on.

Thanks.

Regards,

David Magnuson

4. Support Staff Posted by Brett on 17 Apr, 2019 08:50 PM

So the hrefs in the links are the same in both HTML documents. The difference is that the styled one has a <base> tag that's likely the culprit. I don't think I even meant for that tag to be included, I'll look into that. To confirm, try the attached file saved to the same folder and see if the links work properly (same file, just removed that base tag).

5. Posted by MrC on 18 Apr, 2019 12:12 AM

I just discovered the same bug. This one really startled me, as when I clicked a link, the browser opened a directory listing where the HTML resides! It was a real WTH moment!

Removing the < base > tag from the generated HTML file resolves the issue.

6. Posted by David Magnuson on 18 Apr, 2019 01:21 AM

Yup, the fixed file works fine.

Glad you were able to track it down. Until it's fixed, I can just edit-out
the offending *<base* tag.

Thanks.

Regards,

David Magnuson

7. Support Staff Posted by Brett on 18 Apr, 2019 11:53 AM

Thanks for checking, I have this fixed for the next update.

-Brett

Comments are currently closed for this discussion. You can start a new one.

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

 22 Apr, 2019 04:51 PM Fountain page breaks 22 Apr, 2019 04:49 PM custom keyboard shortcut not applied 21 Apr, 2019 09:36 PM Mismatch between preview and print output for header numbering 18 Apr, 2019 02:59 PM Metadata support for Hebrew. 18 Apr, 2019 11:53 AM Can you provide me with a non-sandboxed/Appstore version of Marked please?

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)