Don't transform files whose TOC is unchanged#169
Closed
akheron wants to merge 1 commit into
Closed
Conversation
Looking at the code, this was always the intention, but there was a
small bug in the logic that this patch fixes.
This is helpful e.g. to check in CI that all TOCs have been updated,
like this:
doctoc --stdout . | grep -q "should be updated" && echo "TOCs are out of date!"
Owner
|
@AndrewSouthpaw this looks nice and assuming it doesn't break existing functionality we could merge that in and publish a major version upgrade. And @akheron sorry for the multi-year delay on my part 😢 |
| - [Multiple Backticks](#multiple-backticks) | ||
| - [code tag](#code-tag) | ||
| - [pre tag](#pre-tag) | ||
| Out of date |
Collaborator
There was a problem hiding this comment.
Could we enhance the tests by comparing the generated TOC with expected content instead of using placeholders? The existing tests seem to simulate real scenarios, so perhaps we could extend that approach to verify that the file remains unchanged when the TOC is already up-to-date.
Contributor
|
I have encorporated this fix into #288 hence this PR should be able to be closed. |
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.
Looking at the code, this was always the intention, but there was a small bug in the logic that this PR fixes. Some tests needed to be updated, because they relied on the fact that even unchanged TOC was reported as transformed.
This is helpful e.g. to check in CI that all TOCs have been updated, like this: