Repository navigation
Add --print option to preview entries without markers - #4
Merged
Merged
Conversation
--print writes the generated entries to stdout, needs no marker pair and never modifies the file. It cannot be combined with --check and accepts exactly one file.
On macOS the temporary directory is a symlink, so an absolute path and a relative path to the same file did not match.
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.
Requested by gulliby
Before
To look at the table-of-contents entries, you had to add the
<!-- toc -->/<!-- tocstop -->marker pair to the file and read the result back.After
--printwrites the generated entries to stdout and never touches the file. No markers are needed; output uses LF line endings and nothing is printed when no heading is selected.--printwith--check, or with more than one file, exits 1 with a clear message.How
src/cli.ts:--printoption, the two conflict checks, usage/help text, print branch inmain.tests/print.test.ts: 15 new tests;tests/cli.test.ts:print: falseadded to three expectedparseArgsobjects.README.md: new "Preview without markers" section and an options table row.