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

Multiple preformatted cells break a table #869

Open
ZoeB opened this issue Apr 26, 2024 · 0 comments
Open

Multiple preformatted cells break a table #869

ZoeB opened this issue Apr 26, 2024 · 0 comments

Comments

@ZoeB
Copy link

ZoeB commented Apr 26, 2024

Hi!

First of all, I love Parsedown, and use it to maintain a personal wiki, thank you!

Here's a bug I found:

A table row containing multiple cells with preformatted text in them doesn't recognise them as multiple cells.

Working

| One	| Two	|
| :--	| :--	|
| ```One```	| Two	|

| One	| Two	|
| :--	| :--	|
| One	| ```Two```	|

| One	| Two	|
| :--	| :--	|
| Only ```partially``` preformatted	| Two	|

| One	| Two	|
| :--	| :--	|
| Only ```partially``` preformatted but ```twice```	| Two	|

Broken

| One	| Two	|
| :--	| :--	|
| ```One```	| ```Two```	|

| One	| Two	| Three	|
| :--	| :--	| :--	|
| ```One```	| Two	| ```Three```	|

| One	| Two	|
| :--	| :--	|
| Only ```partially``` preformatted	| ```Two```	|

| One	| Two	| Three	|
| :--	| :--	| :--	|
| One	| ```Two```	| ```Three```	|

I believe the issue might lie wtih line 1037 erroneously matching the pipes as part of the preformatted text.

Changing it from this:

            preg_match_all('/(?:(\\\\[|])|[^|`]|`[^`]++`|`)++/', $row, $matches);

...to this (inserting an extra pipe):

            preg_match_all('/(?:(\\\\[|])|[^|`]|`[^|`]++`|`)++/', $row, $matches);

...tentatively seems to fix the issue.

Time permitting, I'll add a pull request with this change.

All the best!

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

No branches or pull requests

1 participant