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: fix space at end of table line #2201

Merged
merged 1 commit into from
Sep 8, 2021
Merged

Conversation

UziTech
Copy link
Member

@UziTech UziTech commented Sep 7, 2021

Marked version: v3.0.2

Markdown flavor: GFM

Description

Fix ignore space after table line.

Contributor

  • Test(s) exist to ensure functionality and minimize regression (if no tests added, list tests covering this PR); or,
  • no tests required for this PR.
  • If submitting new feature, it has been documented in the appropriate places.

Committer

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

@vercel
Copy link

vercel bot commented Sep 7, 2021

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/JCHBvjnQaXpBPM9gTPAUNRsX7dhN
✅ Preview: https://markedjs-git-fork-uzitech-table-space-markedjs.vercel.app

@calculuschild
Copy link
Contributor

calculuschild commented Sep 8, 2021

Edit: Bwahahahaha. Disregard. I misread the regex so this is all fine. Approved.

This solves the immediate problem, but I wanted to run a couple thoughts by you guys in case there is a deeper issue we should handle in following the (vague) GFM Spec:

  1. Leading and trailing pipes | are not required on table rows. We currently don't allow for this on the delimiter row but perhaps we should for consistency with other cells, since I don't see anything in the Spec that says delimiter rows are exempted from this rule.
  2. The spec says: "The delimiter row consists of cells whose only content are hyphens (-), and optionally, a leading or trailing colon (:), or both". However, it also says: "Spaces between pipes and cell content are trimmed." That is: trailing and leading spaces are not counted as part of the cell content. This indicates to me that a delimiter cell | :----: | should be a valid delimiter, since the cell's only content is :----: ; the spaces are trimmed and not considered part of the content. Edit: Looks like we already handle this one; I didn't realize.

If these are both true, then we might further adjust this PR to handle not just ending spaces, but also ending without a pipe at all.

So this would be a valid table:

a  |  b 
-- | -- 
c  |  d

And it works in Github:

a b
c d

But we currently can't handle it.

@UziTech UziTech merged commit 910f0f0 into markedjs:master Sep 8, 2021
@UziTech UziTech deleted the table-space branch September 8, 2021 20:20
github-actions bot pushed a commit that referenced this pull request Sep 8, 2021
## [3.0.3](v3.0.2...v3.0.3) (2021-09-08)

### Bug Fixes

* fix space at end of table line ([#2201](#2201)) ([910f0f0](910f0f0))
@github-actions
Copy link

github-actions bot commented Sep 8, 2021

🎉 This PR is included in version 3.0.3 🎉

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.

Trailing whitespace at the end of table delimiter row breaks table rendering
3 participants