You are viewing a single comment's thread.

view the rest of the comments →

argosciv ago

Oh holy shit, it works...

Update: Oh my fucking god I love you Putt(and whoever else contributed to the TOC code)! You can anchor to top level comments!!!

@Vindicator @PuttItOut @srayzie @kevdude @PeaceSeeker

srayzie ago

What do you mean “anchor to top level comments”?

argosciv ago

See how there's a "Section X" link in the Table of Contents section at the top of the main post?

Clicking that will scroll down to the comment containing the "Section X" title.

srayzie ago

How do we do it?

Section X

But how?

argosciv ago

Okay so how it works is this:

When using header formatting(#, ##, ###), you can create 'internal' links which will jump to that header.

To make a link, you can simply format the text as a url, but the 'url' part is merely a single #, followed immediately by "md-" then use the exact same text as the header(lowercased, replace any spaces with another "-"). For example:

Link:

[Section 1](#md-section-1)

Will scroll to header:

#Section 1

However!

When linking to a header in the main post or a top-level comment, the best practice is to provide the full url of the submission, along with the associated "#md-" extension.

For example, when you read this comment in your inbox or if you visit this comment specifically(or via 'context'), the simple url in the above example will not work:

Section 1

But, if we change the above to:

[Section 1](https://voat.co/v/argosciv/3071688#md-section-1)

It will take us back to the main post, and scroll to "Section 1":

Section 1

Vindicator ago

Thanks for the ping, argo. This is cool!

srayzie ago

Thank you!!

argosciv ago

You're welcome :)

srayzie ago

Oh wow! Me and you are big into formatting. Perfect!