-
-
Notifications
You must be signed in to change notification settings - Fork 180
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
Escaped pipes are ignored within table cells #258
Escaped pipes are ignored within table cells #258
Comments
Yeah, open to PRs 👍 |
Looking deeper into this, I see the same output when parsing a table with escaped pipe characters with react-native-simple-markdown as well. And both seem to be built on top of simple-markdown. Will close this for now, and report there. |
Reopened - this library has diverged a lot from simple-markdown so good to fix this separately. |
@probablyup Ok, thanks. I tried to look into the code, but was not able to get the full picture. Would you be able to point me to any logic involved for this specific case, or hints on how you would go about making a fix for this? Here is the new issue I created, which also mentions my crude test repo I've been playing with to solve this: https://github.com/robaxelsen/markdown-to-jsx-table-pipe-test |
I think probably here: https://github.com/probablyup/markdown-to-jsx/blob/master/index.js#L162 Checking and rejecting pipes that have an escape |
@probablyup Thanks! I did some testing, and seems that line is used to match any line that is part of a table markdown. This one seems promising though, as it's used throughout the code to split the row into cells, if I am reading the code correctly: https://github.com/probablyup/markdown-to-jsx/blob/5d4470314de8d652435e581851e4e8e2ef78a6c0/index.js#L174 Tried replacing it with regex that should ignore the escaped pipe, but having issues getting it to match. Have any ideas? Posted a relevant stackoverflow question here, which might help shed some more light on this: https://stackoverflow.com/questions/57306043/splitting-complex-string-with-while-ignoring-escaped-delimeter |
In Edit: sent you a PR: #261 |
Should fix quantizor#258 A port of ariabuckles/simple-markdown@f32a628 to markdown-to-jsx. Previously, tables were parsed using String.prototype.split on pipe (`|`) characters. This commit changes table parsing to use a full parse() call, using a new `tableSeparator` rule to match tableSeparators. Because `tableSeparator` is now a rule, the `escapedText` rule can handle escaped pipes within the table, and the `codeInline` rule can handle inline code with pipes in it. Test plan: Added tests to index.compiler.spec.js
Should fix #258 A port of ariabuckles/simple-markdown@f32a628 to markdown-to-jsx. Previously, tables were parsed using String.prototype.split on pipe (`|`) characters. This commit changes table parsing to use a full parse() call, using a new `tableSeparator` rule to match tableSeparators. Because `tableSeparator` is now a rule, the `escapedText` rule can handle escaped pipes within the table, and the `codeInline` rule can handle inline code with pipes in it. Test plan: Added tests to index.compiler.spec.js
Hi 👋 😄
I am running into this issue in Storybook, which uses markdown-to-jsx for markdown parsing: storybookjs/storybook#6869
Could not find any issues here regarding this, so reporting it. Would it be possible to fix this? Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: