Files
ar9av__obsidian-wiki/probe2.py
Amir Fathi f268d43744 fix(lint): stop flagging embeds and normalise .md/escaped-pipe wikilink targets (#204)
* fix(lint): stop flagging embeds and normalise .md/escaped-pipe wikilink targets

broken_links harvests every [[wikilink]] target, including embeds
(![[diagram.png]], [[board.canvas]], [[dashboard.base]]) that by_slug can
never hold since _iter_pages globs only *.md. An explicit .md suffix
([[alpha.md]]) and a table-escaped pipe ([[beta\|B]]) were also compared
raw against the slugged index instead of being normalised the way
_normalise_node_id already normalises a page's own id, so both never
resolved either.

_wikilink_page_target() returns None for a non-.md-extension target
(skipping attachment embeds) and otherwise strips an explicit .md suffix
and a trailing backslash before _parse_page slugs it. On the issue's own
repro vault this drops broken_links from 7 flagged (6 false positives) to
the one genuinely broken link.

Fixes #176

* fix(lint): only skip attachment extensions, not every dotted page name

Path("Node.js").suffix is ".js", so the previous `if suffix: return None`
dropped links to any page whose name contains a dot. Those links feed orphan
detection and link_count as well as broken_links, so "Node.js", "Next.js",
"v1.2 release notes" and friends were reported as orphans.

Skip only Obsidian's attachment extensions instead.

---------

Co-authored-by: ar9av <ar9avg@gmail.com>
2026-09-03 04:09:35 -07:00

868 B