What's the Markdeep anchor for my heading?

180 views Asked by At

I have a Markdeep document that includes a heading:

### `PG::ConnectionBad - Is the server running locally`...

I want to link to this section from elsewhere in the document. It can be reached with #toc4.2.16, which is all very well, until I change the number of sections above it.

In GitHub it would be something like #pgconnectionbad---is-the-server-running-locally, but that doesn't seem to work. I know Markdeep generates anchors in a similar fashion, because I can reach a much simpler heading, # Errors, with #errors; how does it generate headings?

1

There are 1 answers

0
PJSCopeland On BEST ANSWER

In general, anchors for headings in Markdeep are generated by downcasing and removing spaces; punctuation and spaces are not converted to hyphens as they are on GitHub.

However, if you have inline code (like this) in a heading, this gets converted differently.

Each block of inline code seems to generate an anchor in the format %EE%80%90nnnn%EE%80%90, where nnnn is a base-36 number generated roughly sequentially - some numbers are skipped. (I have a feeling this is to keep them sequential but never generate a previously-used number for a different heading on the same page.)

You can find out the exact anchor by inspecting the source code, or (recommended) you can insert your own with <a name="your-anchor-here"></a> and use #your-anchor-here in your links.