Why {#ref*} at end of heading

When compiling to MMD, some headings have a {#ref*} appended in the compiled md file. For example:
##### A. Bash Programs {#ref8}

Why? How can I get rid of that?

In general {#id} at the end of a heading allows a specific cross-reference to a heading specified manually: Pandoc - Pandoc User’s Guide

As to why you get these I don’t really know, can you make a simple reduced project that reproduces this? At least in Basic Pandoc test compile I see no manual {#id} added, and I don’t understand where your * is coming from?

This will happen if the following conditions are present:

  • You are having Scrivener convert internal cross-references to Markdown syntax.
  • You have linked to a section of the binder that uses a name identical to another section in the binder.

This avoids problematic cases like this in the Markdown file:


## Name of Chapter

Here is a link to some [Subsection][].

## Subsection

The first such section.

## Subsection

The second such section.

The failure case here would be to link to the first instance, but if you really meant to target the second one, you need to use a custom ID, and refer to that section specifically with your link. Scrivener handles that dirty work for you by appending a custom ID and then modifying the Markdown links pointing to it to refer to its ID rather than its name.

Why? How can I get rid of that?

Don’t create a heading structure with duplication, but it isn’t generally a problem that is larger than what might be an issue in avoiding duplication in headings. One might have a very good reason for doing so, like a book with a series of exercises that all use the same formulaic subheadings for the different parts.

1 Like

This indeed seems to be my problem:

But how can I create a “custom id” for a heading? (I search “custom id” in the Manual but get no result.)

Thank you for all the prompt help!

The documentation for them is around page 63, under subheading Heading identifiers, in the PDF version, but it was already linked to in the online version above.

As for tips about Scrivener, here is a short how-to on that.

1 Like