Skip to content

Skip link targets in the linter - #44

Open
rbastian wants to merge 1 commit into
AminBlg:mainfrom
rbastian:lint-skip-link-targets
Open

rbastian wants to merge 1 commit into
AminBlg:mainfrom
rbastian:lint-skip-link-targets

Conversation

@rbastian

Copy link
Copy Markdown

Problem

The PostToolUse check reports em_dash on a dash that is part of a file name.

An Obsidian note links to other notes by file name, for example [[myQ Accounting EAM - Architecture]]. The spaced hyphen in that name matches the DASH pattern. The hook then tells the agent to fix the hit. The agent cannot fix it, because a change to the name breaks the link. A Markdown link target such as [the guide](docs/Setup - Linux.md) has the same problem.

The linter already exempts code spans and URLs for the same reason. SKILL.md also says to never touch file paths or identifiers.

Change

strip_links() in evals/ste_lint.py does two things:

  1. It replaces a wiki link or embed ([[...]], ![[...]]) with one placeholder word, LINK.
  2. It keeps the visible text of a Markdown link and removes the (...) target.

The link text is still linted, so a dash in the text a reader sees is still flagged. strip_code() and reader_check() both call the new function, so the file check and the reply check agree. Newlines do not change, so the line numbers in hook output stay correct.

Tests

LINK_FIXTURE has four spaced dashes. Three are in link targets and one is in link text. Before this change the linter flags 4. After it, the linter flags 1, in both lint() and reader_check(). A new hook test writes a note with dashed link targets and expects exit code 0.

All four CI steps pass locally: ste_lint.py --self-test, test_lint_hook.py (16 tests), the Node tests (12), and check_numbers.py.

PR #42 also edits strip_code(). If #42 merges first, I will rebase this PR on it.

🤖 Generated with Claude Code

A wiki link or a Markdown link target is a file name or a path. The
linter treated a spaced hyphen inside one as an em-dash, so a note that
links to [[Release Notes - Draft]] failed the PostToolUse check.

strip_links() replaces a wiki link or embed with one placeholder word,
like a code span or a URL. It keeps the visible text of a Markdown link
and removes the target, so the link text is still linted. strip_code()
and reader_check() both call it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant