Link does not exist when I compile to .md; the link exists when I compile to .pdf

I used “insert → add link” to add a simple link in my Scrivener3 file: the link shows the word “HTML” and links to “HTML - Wikipedia”.

  • Link works if I click on it in Scrivener3.
  • Link works when I compile to .pdf.
  • Link does not exist when I compile to .md.

The .md file:

---
title: temp  
author:
---

In order to create valid HTML, you need
 properly coded syntax that can
 be cumbersome for "non-programmers" 
to write. Sometimes, you just want to easily make certain words bold, and certain words italicized without having to remember the syntax. 


Additionally, for example, creating lists:

* should be easy
* should not involve programming

Your attachment was not attached, probably because you don’t yet have sufficient posting privileges.

What happens to the link in the .md file? Gone altogether, or just not clickable?

Scrivener’s default compile settings for Markdown are to presume that you use links in Scrivener for internal purposes only, and will be forming Markdown syntax for any links you want the reader to also make use of.

To have all links converted, including internal links between sections, enable the Convert links to MultiMarkdown checkbox, in the General options tab of the compile overview screen, on the right.

P.S. I added a code block to your post so that the Markdown text you pasted wasn’t converted to HTML, as the forum uses Markdown. :slight_smile:

1 Like

Thank you @AmberV!

Where is the compile overview screen?

It’s just the main window you get when first loading compile. There are a series of tabs on the right side of that, one of which contains general options for the project’s compile settings.

Ioa, do you think that this is working even with the Splitter script? It looks like the links to other Scrivener documents in a project are not converted to markdown links, here.

Paolo

I can’t think of a reason for why they wouldn’t. There would be nothing fundamentally different about how the .md file itself is constructed, from Scrivener’s side of things—it is oblivious to anything happening after it creates the single .md file. As always the best way to troubleshoot the process would be to disable the option in the Processing pane that deletes the source .md file it splits from, so you can see what Scrivener is making itself, before it goes on for further processing—same way you’d troubleshoot why something looks off in HTML conversion: step one is to stop converting and look at the .md file to see whether Scrivener is the thing not doing something, or the conversion (MMD or Pandoc). And if you’ve got even more automation going on, straight through Quarto to HTML, and are only looking at that, then you’ve got even more complexity in the way, obscuring what is happening.

1 Like

Yet, I can’t manage to make cross-references to other documents work.

I have a source marked as a link to a document in Scrivener. When compiling, the “Convert Links to MultiMarkdown” option is enabled. But my links are transformed into this, in the generated markdown:

[My Link Source][]

In other words, the link is removed. Do you see a reason why it is behaving this way?

Paolo

Sorry, I don’t understand. You have presented a valid Pandoc/MMD cross-reference link, and are seeming to be using it demonstrate a case where you do not get a link. That is what a cross-reference may look like (it can also be simpler, like [My Link Source] which is what I prefer, as I type them myself in seeing as how they are so basic looking).

markdown_link_conversion_test.zip (132.7 KB)

Here is the Markdown file it creates (in excerpt):

* [My Link Source]
* [My Link Source][]
* [With alternate link text][My Link Source]
* [My Link Source][]
* [With alternate link text][My Link Source]

...

# My Link Source #

And here is the HTML output (created via pandoc -o test.html test.md):

<ul>
<li><a href="#my-link-source">My Link Source</a></li>
<li><a href="#my-link-source">My Link Source</a></li>
<li><a href="#my-link-source">With alternate link text</a></li>
<li><a href="#my-link-source">My Link Source</a></li>
<li><a href="#my-link-source">With alternate link text</a></li>
</ul>
<p>...</p>
<h1 id="my-link-source">My Link Source</h1>

Ah, so the problem is not in the generated markdown, then (I was thinking the second set of parentheses had to be round, and not square). But my markdown:

[My Link Source][]

becomes this one, when converted by Quarto:

[My Link Source][]

If I use the simpler version ([My Link Source]) the output still remains the same as the input.

That is, it is not converted at all. Considering how the Splitter script removes all the spaces from the Scrivener document names, it should have been something like:

<a href="MyLinkSource.html">My Link Source</a>

I tried replacing the second set of square parentheses with a set or round ones (so, [My Link Source]()), and this time Quarto generated a valid link, even if pointing to nothing:

<a href="">My Link Source</a>

It looks like my internal links to documents go nowhere in any case.

Obviously, I can still enter the actual links manually in the source Scrivener documents, but either I break the internal links, that are very useful in many cases, or create a complex system of alternative links.

Paolo

I’ve tried something else: I’ve left the link to a Scrivener document in the source, and used Web Only character styles to make the HTML links. So, it is now something like:

[My Link Source](MyLinkSource.html), with the square parentheses and (MyLinkSource.html) with the Web Only character style applied.

This translates in the markdown like this:

[[My Link Source][]](MyLinkSource.html)

that becomes this in the web page:

<a href="MyLinkSource.html">[My Link Source][]</a>)

There is a couple square parentheses too much, after the visibile text. I guess it is because I added them in the source. But without them, the manually added link doesn’t work.

So, it seems it can be either the internal link, or an external one.

Or, I can add a replacement in the Compile format, with sequences of ][] becoming just ]. (Didn’t work. Maybe the replacement happens before the links are created).

Paolo

You can use round brackets, but then you would need to make use of a valid anchor name and syntax, since at that point it is a “non-magical” direct link that just so happens to point to something in the document rather than anywhere in the world. The square bracket method is designed to be a writer-friendly tool, so we can merely type in the section name naturally, as we would refer to it ourselves, rather than, [My Link Source](#my-link-source).

But it does presume the heading target is in the same context as the reference. As for breaking that (splitting files and putting things into different contexts), I feel like this specifically has already been discussed, and established that one should be using Quarto’s cross-referencing syntax for multi-file site management, rather than pure Markdown. I.e. not using Scrivener’s convenience pure Markdown converter.