Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _uniform_outdent failing with empty strings (issue #505) #506

Merged
merged 4 commits into from Apr 10, 2023

Conversation

Crozzers
Copy link
Contributor

@Crozzers Crozzers commented Apr 8, 2023

This PR fixes #505.

_uniform_outdent attempts to find the smallest common whitespace between lines by using the min function.
If the text being passed into _uniform_outdent is empty or only consists of \n chars, then there will be no detected whitespace, leading to an empty sequence being passed to min, which throws an exception.

This PR adds a check within _uniform_outdent so that if no whitespace is detected, the function returns early.

@mhils
Copy link
Contributor

mhils commented Apr 8, 2023

You're beating me to it, thanks so much! 🍰

@nicholasserra
Copy link
Collaborator

LGTM thanks both of you!

@nicholasserra nicholasserra merged commit d657fca into trentm:master Apr 10, 2023
18 checks passed
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.

fenced-code-blocks fails with empty blocks
3 participants