Skip to content

fix(readme): TOC anchors had a leading hyphen, so none of them resolved - #13

Merged
ruslanlap merged 2 commits into
masterfrom
fix/toc-anchors
Sep 30, 2026
Merged

ruslanlap merged 2 commits into
masterfrom
fix/toc-anchors

Conversation

@ruslanlap

@ruslanlap ruslanlap commented Sep 30, 2026 •

Copy link
Copy Markdown
Owner

What

None of the TOC links resolved. They all looked plausible in the diff, which is why two earlier passes "fixed" the TOC and left it broken.

Root cause: GitHub strips a heading's emoji and the whitespace before it, so ## 📏 Виміряно anchors to #виміряно — no leading hyphen. Every entry carried one:

- [Виміряно](#-виміряно)     → 404
+ [Виміряно](#виміряно)      → works

The #%EF%B8%8F-конфігурація percent-encoded form was also wrong, and the badge link in the header pointed at the broken #-виміряно.

The part that matters

Anchors in a README are invisible to tests, so they rot silently. tests/readme-toc.test.js transcribes github-slugger's algorithm and asserts:

  • every H2 has a TOC link
  • no orphan TOC entries
  • every anchor equals the real slug of its heading
  • no leading-hyphen anchors
  • inline in-page links elsewhere in the file resolve too

Verified the test actually catches this class of bug: re-adding the hyphen fails 4 of 6 assertions, removing it passes 6 of 6.

141 tests pass.


Devin Review

GitHub strips a heading's emoji AND the whitespace before it, so
'## 📏 Виміряно' anchors to #виміряно. Every TOC link carried a leading
hyphen from the earlier fix, which looks plausible in a diff and 404s in
the browser.

Adds tests/readme-toc.test.js with github-slugger's algorithm
transcribed: every H2 has a link, no orphans, every anchor equals the
real slug, and no leading-hyphen anchors. Verified the test fails (4/6)
when the hyphen is put back and passes (6/6) without it.

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 2 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

The README documented 'hermes skill install cavemenko' — a subcommand
that does not exist. Verified end to end instead:

  hermes skills install \
    "https://raw.githubusercontent.com/ruslanlap/cavemenko/master/skills/cavemenko/SKILL.md" \
    --category productivity

Hermes fetches, security-scans (verdict SAFE) and installs it as
productivity/cavemenko, source-tracked as url/community, so
'hermes skills check' and 'hermes skills update' work afterwards.

Docs now cover install / check / update / uninstall, the auto_load step
without which the skill is available but not active, and the offline
copy path.

Tests: no invented 'hermes skill install' anywhere, update+uninstall
documented, auto_load documented, raw URLs on the master branch (the
default branch here is master, not main), and a live HEAD check that
every raw URL returns 200 — a 404 is exactly the failure where the
install command silently finds nothing.

147 tests pass.
@ruslanlap
ruslanlap merged commit 0006e63 into master Sep 30, 2026
3 checks passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 359d826114

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tests/readme-toc.test.js
return text
.toLowerCase()
.replace(/[^\p{L}\p{N}_\- ]/gu, '')
.trim()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the leading space in the GitHub slug model

For every H2 that starts with an emoji, github-slugger removes the emoji and then replaces spaces with hyphens; it does not trim the space left behind. Thus 📏 Виміряно becomes -виміряно, not виміряно. This .trim() makes the new test bless the wrong behavior, so the changed README anchors without a leading hyphen do not resolve on GitHub.

Useful? React with 👍 / 👎.

@ruslanlap
ruslanlap deleted the fix/toc-anchors branch September 30, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant