Skip to content

Fix table/list parsing ambiguity - #767

Merged
puzrin merged 2 commits into
markdown-it:masterfrom
hukkin:table-ambiguity
Mar 27, 2021
Merged

puzrin merged 2 commits into
markdown-it:masterfrom
hukkin:table-ambiguity

Conversation

@hukkin

@hukkin hukkin commented Mar 26, 2021

Copy link
Copy Markdown
Contributor

Fix parsing of

a | b
- | -
1 | 2

Markdown-it parses it as a table, but it should not be one, because there is a list on the second line that intercepts the table.

The GFM spec says:

A leading and trailing pipe is also recommended for clarity of reading, and if there’s otherwise parsing ambiguity.

Also GitHub's own parser parses this as a list, not a table.

@puzrin
puzrin merged commit cd5296f into markdown-it:master Mar 27, 2021
@hukkin
hukkin deleted the table-ambiguity branch March 27, 2021 11:12
@laurent22

laurent22 commented Mar 2, 2023 •

Copy link
Copy Markdown

This actually introduces a regression for everybody who was writing their table without leading pipes. See here for example. Is this change really necessary? If there's a parsing ambiguity, then this ambiguity still exists after this change, and the only difference is that it broke a lot of existing Markdown documents.

@rlidwka

rlidwka commented May 26, 2023

Copy link
Copy Markdown
Member

@laurent22 answered in laurent22/joplin#7858 (comment)

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.

5 participants