CppCoreGuidelines icon indicating copy to clipboard operation
CppCoreGuidelines copied to clipboard

Markdown: jump in references don't match header line anchors

Open hegger opened this issue 2 years ago • 5 comments

In the central CppCoreGuidelines.md the jump references to headers don't match the reference anchors of the headers.

I didn't check all but ,e.g.,

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#S-expr

should point to

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#es-expressions-and-statements

instead.

hegger avatar Apr 28 '23 13:04 hegger

That is intentional. The used anchors are stable. The GitHub generated anchors can change if the text changes.

JohelEGP avatar Apr 28 '23 14:04 JohelEGP

Sorry, I get that only partially.

I know that some markdown dialects generate anchors automatically out of header lines, e.g. This doesn't help you if the links referencing these headers intentionally use different labels.

So, you have one markdown. At the top is the jump section and if you press any link the browser doesn't jump to the - probably intended - anchor location. This does not work.

So, I'm confused now.

hegger avatar Apr 28 '23 15:04 hegger

The links work when you read the guidelines at http://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines instead of using your links.

jwakely avatar Apr 28 '23 15:04 jwakely

Looks like something you should report to GitHub instead.

JohelEGP avatar Apr 28 '23 18:04 JohelEGP

it used to work in both gh-pages and github, but then github started prefixing all custom anchors with user-content. So when guidelines.md says # <a name="S-expr"></a>ES: Expressions and statements

gh-pages generates <a name="S-expr"></a>ES: Expressions and statements

while github.com now makes it <a name="user-content-S-expr"></a>ES: Expressions and statements

( both also have the auto-generated "#es-expressions-and-statements", but we don't want to use those as they change when rule names get edited)

cubbimew avatar Apr 28 '23 19:04 cubbimew