"Convert Rich Text to MultiMarkdown", duplicate file names and "[ref …]"

User avatar
glauschwuffel
Posts: 4
Joined: Sat Jul 15, 2017 10:59 am
Platform: Mac
Location: near Hamburg, Germany
Contact:

Fri Jan 05, 2018 9:34 pm Post

Hi,

I'm using Scrivener 3.0.1 and want to compile a document to MultiMarkdown. Let's say this document has two files with the same name. For example I have two files named "example".

When "Convert Rich Text to MultiMarkdown" is not checked, both file names are converted to "# example". If "Convert Rich Text to MultiMarkdown" is checked, the name of the second file is converted to "#example [ref1]". If there are more files with duplicate names in the document, the number at the end of "ref" is increased.

Is there a way to "Convert Rich Text to MultiMarkdown" without these additions of "[ref …]"?

Thanks!

User avatar
AmberV
Posts: 22065
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Sat Jan 06, 2018 12:42 pm Post

There are no options tweaking the behaviour of this feature. What is the use case here—why would you want the headings to have colliding IDs?
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
glauschwuffel
Posts: 4
Joined: Sat Jul 15, 2017 10:59 am
Platform: Mac
Location: near Hamburg, Germany
Contact:

Sat Jan 06, 2018 4:16 pm Post

The use case is this: In my writing I discuss a series of books. I discuss each book in a section with basically the same subsections ("Contents", "Characters" etc.).

When exporting to Markdown with "Convert Rich Text to MultiMarkdown" checked I get the subsection "Contents" for the first book, "Contents [ref1]" for the second book and so on.

I think I didn‘t make my point clear enough. I don’t want colliding IDs in the headings, I just want the headings in the form I get when "Convert Rich Text to MultiMarkdown" is not checked – without any IDs in them. I'm just surprised to see that behaviour and I thought there would be a configuration option that I just missed.

User avatar
AmberV
Posts: 22065
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Sun Jan 07, 2018 12:34 am Post

I think I didn‘t make my point clear enough. I don’t want colliding IDs in the headings, I just want the headings in the form I get when “Convert Rich Text to MultiMarkdown” is not checked – without any IDs in them.

Okay, just in case it isn’t known then, MultiMarkdown expects you to handle identical headings with custom IDs yourself, otherwise you’ll get invalid documents in cases where it matters—hence why Scrivener strives to avoid creating invalid output since this mode of operation is more designed to achieve some format rather than MMD files as the final stop. Pandoc will generate its own internal IDs for you if it detects a collision (so similar to what Scrivener is doing).

Either way though, you can override Scrivener’s automatic ID by supplying your own. For example:

Code: Select all

# Example [bookone-example]


This will also fix Scrivener’s internal automatic cross-referencing if you make use of that. For example if you link to this section from another part of the book, it would create an MMD style link like so:

Code: Select all

[hyperlink text][ref1]


And if you override it, then it will use the overridden value:

Code: Select all

[hyperlink text][bookone-example]
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
glauschwuffel
Posts: 4
Joined: Sat Jul 15, 2017 10:59 am
Platform: Mac
Location: near Hamburg, Germany
Contact:

Sun Jan 07, 2018 7:09 pm Post

Thanks for the explanation about the handling of duplicate IDs in pandoc. Before I started to use the "Convert Rich Text to MultiMarkdown"-feature I did all the markdown linking within my document by hand. Since this got a bit tedious I wondered if Scrivener‘s linking features would be helpful for me. And indeed they have been very helpful.

The overriding mechanism seems to be exactly what I need. However, I can't figure out how to provide my own ID.
Since I don‘t write my heading in markdown but as the name of a file, I don't seem to be able to provide the ID.

Example: The name of the file is

Code: Select all

Contents [testid]

Resulting markdown:

Code: Select all

# Contents [testid] #


And Scrivener generates a matching link to that file:

Code: Select all

[Link text][Contents][testid]]


Do I have to escape the brackets in the title in some way?

Thanks again for your help!

User avatar
AmberV
Posts: 22065
Joined: Sun Jun 18, 2006 4:30 am
Platform: Mac + Linux
Location: Santiago de Compostela, Galiza
Contact:

Mon Jan 08, 2018 12:44 pm Post

All right, sorry to say that isn't supposed to be working. I thought it was given the fact that brackets were not being escaped in the binder titles (normally they would be, so that PDF, RTF, ePub and MMD all look the same), but in fact that's just an accidental side effect of there being no processing done in the title field at all.

So it looks like you'll need to stick with the automatically generated serial names.
.:.
Ioa Petra'ka
“Whole sight, or all the rest is desolation.” —John Fowles

User avatar
glauschwuffel
Posts: 4
Joined: Sat Jul 15, 2017 10:59 am
Platform: Mac
Location: near Hamburg, Germany
Contact:

Mon Jan 08, 2018 7:45 pm Post

I guess I‘ll have to find a workaround then.

Thanks again for looking into my issue!