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 👀 |
## [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 📦🚀 |
## [4.0.8](markedjs/marked@v4.0.7...v4.0.8) (2021-12-19) ### Bug Fixes * spaces on a newline after a table ([#2319](markedjs/marked#2319)) ([280d3d1](markedjs/marked@280d3d1))
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.