Repository navigation
fix: strip trailing whitespace from generated vimdoc - #78
Merged
Merged
Conversation
Code blocks indent every line with four spaces, blank lines included. Lists and definition lists add their own indentation on top, and tables pad their cells, so the generated vimdoc has lines ending in whitespace. Editors, .editorconfig and pre-commit hooks that trim trailing whitespace then rewrite the file after every generation. Strip trailing whitespace from the rendered body. Blank lines in code blocks become empty lines, which do not end a code block in Vim or Neovim. The render tests stripped trailing whitespace from the output before comparing, which hid this. Compare the output exactly instead.
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.
Generated vimdoc has trailing whitespace. Code blocks indent their blank lines, lists and definition lists indent them again, and tables pad their cells. Editors and pre-commit hooks that trim whitespace then rewrite the file after every run, so it never matches fresh output (which also defeats #77).
This strips trailing whitespace from the rendered body once, in
Writer.Pandoc.For example, this Markdown:
renders as follows.
$marks the end of each line:>lua$ local a = 1$ - $ +$ local b = 2$ <$Writer.Pandocrather thanCodeBlockbecause lists and definition lists skip empty lines, so blank lines in nested code blocks would otherwise disappear.