-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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: spaces on a newline after a table #2319
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/markedjs/markedjs/8R4yxox13gcfwaQktGJmJxcEEPoW |
does this fix #2278 as well? |
after a little bit of experimenting it looks like a better fix would be to change the line: - rows: cap[3] ? cap[3].replace(/\n$/, '').split('\n') : []
+ rows: cap[3] ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : [] basically removing any trailing space characters before creating rows. This would allow removing more than 4 spaces without affecting fenced code blocks inside the table. |
Thanks. It's a better solution. |
@imchell can you make that change and leave the test to make sure it works? |
@UziTech updated 👀 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 💯
## [4.0.8](v4.0.7...v4.0.8) (2021-12-19) ### Bug Fixes * spaces on a newline after a table ([#2319](#2319)) ([f82ea2c](f82ea2c))
🎉 This PR is included in version 4.0.8 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Marked version: 4.0.7
Markdown flavor: Markdown.pl|CommonMark|GitHub Flavored Markdown|n/a
Description
The problem can be solved by removing the last table row with no data. The row matching
/^ {1,4}$/
should be removed. There is no need to deal with/^ {5,}$/
since more than 4 spaces would be parsed to a fenced code block.Contributor
Committer
In most cases, this should be a different person than the contributor.