Skip to content

Conversation

@robinst
Copy link
Collaborator

@robinst robinst commented Jun 18, 2025

GitHub doesn't mention it in their spec but it does work, e.g.:

text
|a|
|---|
|b|

Parses as a paragraph with "text", and a table.

Implement this in commonmark-java by changing the replaceActiveBlockParser functionality to a replaceParagraphLines that allows to only replace some lines. Using that, we can change the table parser to interrupt a paragraph.

Fixes #372

@robinst robinst force-pushed the tables-without-blank-line-before branch from 051c3ce to 4c97ab6 Compare June 20, 2025 11:52
@robinst robinst marked this pull request as ready for review June 20, 2025 11:53
@codecov
Copy link

codecov bot commented Jun 20, 2025

Codecov Report

Attention: Patch coverage is 75.00000% with 9 lines in your changes missing coverage. Please review.

Project coverage is 94.79%. Comparing base (8b6ecb6) to head (bb57a5f).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...n/java/org/commonmark/internal/DocumentParser.java 53.33% 6 Missing and 1 partial ⚠️
...n/java/org/commonmark/internal/BlockStartImpl.java 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #381      +/-   ##
============================================
- Coverage     94.94%   94.79%   -0.16%     
  Complexity      252      252              
============================================
  Files           138      138              
  Lines          4471     4493      +22     
  Branches        646      649       +3     
============================================
+ Hits           4245     4259      +14     
- Misses          122      129       +7     
- Partials        104      105       +1     
Files with missing lines Coverage Δ
...mark/ext/gfm/tables/internal/TableBlockParser.java 98.79% <100.00%> (ø)
...in/java/org/commonmark/internal/HeadingParser.java 98.63% <100.00%> (ø)
...onmark/internal/LinkReferenceDefinitionParser.java 97.24% <100.00%> (+0.20%) ⬆️
.../java/org/commonmark/internal/ParagraphParser.java 100.00% <100.00%> (ø)
...n/java/org/commonmark/parser/block/BlockStart.java 100.00% <ø> (ø)
...n/java/org/commonmark/internal/BlockStartImpl.java 90.90% <66.66%> (-9.10%) ⬇️
...n/java/org/commonmark/internal/DocumentParser.java 96.84% <53.33%> (-2.09%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

GitHub doesn't mention it in their spec but it does work, e.g.:

    text
    |a|
    |---|
    |b|

Parses as a paragraph with "text", and a table.
@robinst robinst force-pushed the tables-without-blank-line-before branch from 4c97ab6 to bb57a5f Compare June 20, 2025 11:55
@robinst robinst merged commit 32c9290 into main Jun 20, 2025
12 of 14 checks passed
@robinst robinst deleted the tables-without-blank-line-before branch June 20, 2025 12:18
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.

When there is only one "\n", the table header cannot be recognized.

2 participants