Skip to content

Accept several Markdown files in one call - #1

Merged
Gulliby merged 2 commits into
mainfrom
feature/multiple-files
Oct 11, 2026
Merged

Gulliby merged 2 commits into
mainfrom
feature/multiple-files

Conversation

@Gulliby

@Gulliby Gulliby commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Before: mdtoc accepts exactly one file; a second path is rejected, so checking a docs folder takes one invocation per file.

After: mdtoc accepts one or more files (mdtoc --check docs/*.md README.md). Each file is processed independently, errors are prefixed with the path (mdtoc: docs/a.md: ...) when more than one file is given, and there is a single exit code: 0 only if every file succeeded (and, with --check, is current), otherwise 1. A single path behaves exactly as before.

How: src/cli.ts (CliOptions.files, per-file processing, duplicate paths processed once), tests/cli.test.ts (new multi-file tests, three old single-file tests updated to the new option shape), README.md (options table and a "Several files" example that a test checks against real output).

Tests: 80 pass (69 before), typecheck and lint clean.

Built with BAKED (bench loop round 03)

mdtoc now takes one or more Markdown files. Each file is processed
independently in the given order, errors are prefixed with the file
path when more than one file is given, and the exit code is 1 if any
file failed or, with --check, is stale. A single file behaves as before.
This lets a whole docs folder be checked in CI with one command.
Resolving the same file through a symlinked temporary directory (macOS) yields different absolute paths, so the test now passes a relative alias of the same path.
@Gulliby
Gulliby merged commit 62cbfa7 into main Oct 11, 2026
6 checks passed
@Gulliby
Gulliby deleted the feature/multiple-files branch October 11, 2026 17:52
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