Repository navigation
Accept several Markdown files in one call - #1
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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)