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: leave whitespace only lines alone #1889

Merged
merged 3 commits into from
Jan 26, 2021
Merged

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Dec 23, 2020

Marked version: v1.2.7

Description

The whitespace is removed from lines with only whitespace. This causes problems in code blocks where the whitespace matters.

This PR keeps the spaces in blank lines and adds them to output.

This PR also adds a new line character to the end of all code blocks.

Contributor

  • Test(s) exist to ensure functionality and minimize regression

Committer

In most cases, this should be a different person than the contributor.

@vercel
Copy link

vercel bot commented Dec 23, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/markedjs/markedjs/qnmzg8281
✅ Preview: https://markedjs-git-fork-uzitech-preserve-space.markedjs.now.sh

@UziTech
Copy link
Member Author

UziTech commented Dec 23, 2020

@davisjam Could you check these regexps for redos vulnerability?

/^(?: *(?:\n|$))+/
/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/

@UziTech
Copy link
Member Author

UziTech commented Jan 24, 2021

I tried testing those regexes with everything that I could think might cause redos and nothing would cause it so I think they are good.

@UziTech UziTech merged commit 53c79ee into markedjs:master Jan 26, 2021
github-actions bot pushed a commit that referenced this pull request Jan 26, 2021
## [1.2.8](v1.2.7...v1.2.8) (2021-01-26)

### Bug Fixes

* leave whitespace only lines alone ([#1889](#1889)) ([53c79ee](53c79ee))
@github-actions
Copy link

🎉 This PR is included in version 1.2.8 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lines with only spaces are removed, even in code blocks
3 participants