Preserving internal links when exporting to files

Hi, I’ve finally settled for Scrivener even though I‘m writing in LaTeX.

I like the possibility to ExportFiles… — it gives me a folder structure with plain rtf/rtfd/html-files in it. Much more comforting than what I saw when I looked into the contents of the project folder where I’d have no clue how all those files were ordered in case I could no longer open the project in Scrivener. It can even number the files – I noticed that when I translated the misleading German Anzahl der exportierten Dateien back to English number [of] exported files

While it preserves footnotes – most important to me – unfortunately, it doesn’t preserve internal links. Is there a way to have it export them somehow while exporting the files one by one with the ExportFiles… command?

I use internal links with the link text <$custom:Label> – so on compile, it gets replaced by the label I defined as a custom attribute on the linked file. (I actually do some replace-magic before and after compile, so in case no custom label has been defined, it falls back to Scrivener’s linkID. If someone is interested, I can provide instructions on how I did this.)

As the internal link is not included in the exported files (I tried rtf, rtfd, html, docx, opml), I get no clue from the exported file as to what Binder item was linked. It just says <$custom:Label> in the normal font and I can’t find out what was referenced.

In the rtf files in the project folder, it is a rtf hyperlink to scrivlnk://document_id. It’d be great if that link was transformed to file:////User/path/to/linked/file.rtfd.

Any suggestions? Thanks, take care –


What do you ultimately want to do with these files? Is this your final output? Do you want to work with the files outside of Scrivener and then import them back?


Thank you for asking back, Katherine!

I can’t find it anymore, but somewhere I’ve seen you advertising the Scrivener file format as there are plain rtf files in the folder and nothing can get lost. When I’ve had a look at it in the trial period, I noticed it was not so obvious how these files belonged together. Following this advertisement promise and not having found what I expected, I’m looking for a way to make a platform- and program-agnostic backup of my current project.

I’ve previously (years ago, for another thesis) worked with Ulysses and then also, I was somehow worried about my documents only available in a special program. Then I found out I could just drag binder items to Finder and get numbered md files in a folder structure corresponding to my binder folders. I liked that and after a productive day, I’d have dragged the folder I had worked on to Finder, zipped it and uploaded it to my SFTP server, reassured that I could come back to that zip file even with just the SSH shell and join it and compile it with Pandoc and LaTeX with just a couple of intermediate steps.

I’d like to do something similar now with Scrivener and the only feature I’m using so far that I can’t backup this way is the internal links. That’s the point of my question.

I’ve looked at a few posts on this topic and I can’t find the answer. I just want to export to a Word Doc and keep the links that I have included in Scrivener when I do so. As one individual noted, the links exist, when you export, but there’s no way to know that if you don’t know where they are or come across them accidentally. Is there a way to do this? Thanks.

I don’t know why you’d put it that way. :slight_smile: I think Scrivener is one of the best platforms for producing LaTeX—whether directly or via conversion with Pandoc/MultiMarkdown. It’s safe to say that most anything I write in Scrivener, if I intend to make a PDF of it, ends up going through LaTeX.

But to get to the point: you are correct in that Scrivener’s format is tuned more toward recovery out of desperation than providing a completely open and usable file repository at all times, or to serve in and of itself as a human-friendly backup. It’s more that if in a worst case scenario, you at least wouldn’t be extracting data out of an arcane database or locked into the format with proprietary binary files. For myself, and anyone with a little scripting knowledge, if I were in the position of having to recover data from a Scrivener project, the way to go would be to write a simple XML trawl on the master .scrivx file—that’s where you would get the metadata and ID mappings, and from there assemble the files into a useful but simplified structure from that same script. This could even resolve links with a small amount of digging into RTF syntax.

That aside, and to get more to heart of what you’re looking for, it sounds to me as though the compiler is going to be a better tool for you, and perhaps the only reason you haven’t gone down that path as yet is on account of how it is generally designed to produce one document from the outline, rather than many documents from the outline. That however is in and of itself only a surface limitation.

You may be interested in this previous conversation. The example project I provided there includes all of the necessary automation to make it work, and should be able to serve as a sufficient proof of concept. It’s not going to do exactly what you want, as I understand it, but it might be a good starting point. I think the main thing you would want to have done differently is to have it work from the Plain-Text output rather than through Markdown, where the latter is then converted to LaTeX. It sounds to me more like you’re using Scrivener to compose LaTeX directly.

And so this is how internal links would be resolved, since the compiler of course has the necessary technology to turn them into something useful outside of Scrivener. For LaTeX, they would end up being useful in an \autoref sense, where they point to the individual sections they were meant to. But I strikes me that it wouldn’t be impossible to create file:// links, it would probably take a little scripting to manage where files are going and being named, but I can’t think of anything that would get in the way of doing so.

I guess the main question is how set you are on using RTF to archive LaTeX material. To me it seems like that wouldn’t be terribly useful, and would impose additional difficulties down the way, but I’ve never been a huge fan of the RTF format for various reasons. I’d rather archive in plain-text (typically with some kind of markup in it).

That sounds like a completely different question to me, more like you’ve having issues with how Word doesn’t highlight hyperlinks by default—so that even if they are in the output you can’t see them?

A few places to look:

  • Make sure that Remove all hyperlinks is disabled, in the general options tab of the compile overview area.
  • For problems with hyperlink visibility, it should be enabled by default, but it would depend on which compile Format you are using in the left sidebar. Whatever the case, double-click on the format to edit it (duplicating if necessary), and in the Compatibility pane, make sure Ensure hyperlinks are colored and underlined is enabled.

Might be best if we split this off to a new thread though, as again it doesn’t sound like you’re asking about ways to bulk export an outline of many files and have an file-based linking network built between them.