You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit e215c65
Browse filesBrowse the repository at this point in the historyBrowse files
fix(md051): validate cross-file link fragments for a document read from stdin
A run over files indexes the whole workspace before resolving cross-file
references. A document piped through `--stdin` has no workspace, so MD051's
cross-file check found nothing to resolve against and stayed silent: `rumdl
check .` reported a broken `[link](other.md#missing)` and piping the same
bytes with `--stdin-filename` reported nothing. Editors and pre-commit hooks
drive rumdl this way, so the finding disappeared for them.
The stdin path now resolves the targets the piped document names, reading
each from disk exactly as MD057 already does here, and only for links that
carry a fragment. A document that links to itself is resolved against the
piped buffer rather than the copy on disk, which is the whole point of
piping an unsaved buffer. Without `--stdin-filename` there is no directory
to resolve a relative destination against, so nothing is read and nothing is
reported, matching MD057.
Which files a run knows about is decided by the ignore files, the configured
include and exclude patterns and the walk's own extension filter, all of
which interact, so a target is read only when a directory scan of the same
project would index it - and that question is put to the scanner itself
rather than to a second opinion about what it would do. A gitignored or
config-excluded target is one `rumdl check .` never reads, and reading it
here would report a finding the batch run does not. The scan runs at most
once per document, and only once a destination names a file that exists.
A scan also indexes each file under the config that governs it, so a target
is read under the config a scan would have resolved for it rather than the
piped document's. A directory with its own rumdl config decides how its
headings are anchored, and reading its files under the root config would
check a link against anchors that file does not have. A config governing a
target that fails to load counts toward --deny-config-warnings, exactly as
it does for a run over files.
Nothing from a target reaches the output: a finding names the fragment and
the destination as the piped document wrote them.
Resolving a destination to the file it names is now one shared function,
replacing three private copies of the same walk, and it keeps a traversal
that leaves the path's own root. A `--stdin-filename` is usually relative,
so `../notes.md` had nothing above it to cancel and the `..` was dropped,
renaming the target to a sibling that exists, sits in the workspace and
answers with its own headings. Above a real root there is nothing to name,
so `/..` stays `/`, which is what the filesystem answers.
0 commit comments