CppCoreGuidelines icon indicating copy to clipboard operation
CppCoreGuidelines copied to clipboard

C++ Core Guidelines Markdown explicit anchor links not working (updated the 20/05/2024)

Open Lob2018 opened this issue 1 year ago • 3 comments

Thanks again for your document C++ Core Guidelines.

Markdown links for C++ Core Guidelines Markdown don't work because anchor test must always be lowercase and not contain spaces, as describe in this article.

I used Sublime Text to find and replace by regular expression with these values, it looks correct but I haven't checked everything (updated the 20/05/2024): Find: name="([^"]*)" Replace: name="\L\1\E" and Find: ]\(#([^)]*)\) Replace: ](#\L\1\E)

Attached the .diff, the modified and the old Markdown files : CppCoreGuidelines - old.md CppCoreGuidelines.diff.txt CppCoreGuidelines.md

Lob2018 avatar May 10 '24 00:05 Lob2018

A small Python program that checks that links, internal links, and anchors, are lowercase without spaces (it could be used as a basis with GitHub Actions in the future see https://github.com/isocpp/CppCoreGuidelines/issues/2210#issuecomment-2346844932); I fixed the errors (see the .diff).

The CppCoreGuidelines.md file must be in the same folder of ChecksLinksAndAnchorsFromCppCoreGuidelinesInCurrentDirectory.py. Error examples:

fixed : Error on line 13828: the href link 'Rper-reason' is not in lowercase. Error on line 13829: the href link 'Rper-Knuth' is not in lowercase. Error on line 22113: the href link 'S-abstract' is not in lowercase. and by the way (not fixed) : Error on line 2931: the internal link '???' is not in lowercase. Error on line 3673: the internal link '???' is not in lowercase. Error on line 3781: the internal link '???' is not in lowercase. Error on line 3796: the internal link '???' is not in lowercase. Error on line 3796: the internal link '???' is not in lowercase. Error on line 5606: the internal link '???' is not in lowercase. Error on line 8184: the internal link '???' is not in lowercase. Error on line 11168: the internal link '???' is not in lowercase. Error on line 15607: the internal link '???' is not in lowercase. Error on line 20346: the internal link '???' is not in lowercase. Error on line 20503: the internal link '???' is not in lowercase. Error on line 20504: the internal link '???' is not in lowercase. Error on line 20527: the internal link '???' is not in lowercase. Error on line 20528: the internal link '???' is not in lowercase. Error on line 20529: the internal link '???' is not in lowercase. Error on line 20530: the internal link '???' is not in lowercase. Error on line 20531: the internal link '???' is not in lowercase. Error on line 20532: the internal link '???' is not in lowercase.

Attached, the Python program, the .diff, the old and the modified Markdown files : ChecksLinksAndAnchorsFromCppCoreGuidelinesInCurrentDirectory.zip CppCoreGuidelines.diff.txt CppCoreGuidelines - old.md With https://github.com/isocpp/CppCoreGuidelines/commit/50afe0234ce4f2f6bde7d9b0d86e926bd479f9aa modification : CppCoreGuidelines.md (got a doubt for Rh-public l.376 : (e.g., for C.134 it is "Rh-public"))

Lob2018 avatar Sep 06 '24 14:09 Lob2018

I think all the anchors are fixed now, but I didn't add any checks to ensure they keep working.

jwakely avatar Nov 14 '25 20:11 jwakely

I think all the anchors are fixed now, but I didn't add any checks to ensure they keep working.

I don't know C++, but I've seen a Makefile in this repository that checks text content. This check could be implemented as a new target in the same Makefile to work both locally and in automated workflows : https://github.com/isocpp/CppCoreGuidelines/blob/master/scripts/Makefile#L38

Lob2018 avatar Nov 14 '25 21:11 Lob2018