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 .md table pipe parsing #51

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

Flaxscrip
Copy link

The regex that populates "matches" gets confused when a markdown table pipe ("|") is directly followed by a markdown double bracket link tag ("[["). Inserting spaces around the pipe allows the regex to parse the markdown text properly.

ex: | column 1 | column 2 |[[link]]| // The link will work but it will be mistakenly rendered as part of column 2 in the HTML output.

It would be more elegant to fix the regex, but I couldn't figure out the right expression. I used this work-around instead.

The regex that populates "matches" gets confused when a markdown table pipe ("|") is directly followed by a markdown double bracket link tag ("[[").   Inserting spaces around the pipe allows the regex to parse the markdown text properly.

ex: | column 1 | column 2 |[[link]]|  // The link will work but it will be mistakenly rendered as part of column 2 in the HTML output.
@claudioc
Copy link
Owner

claudioc commented Oct 2, 2014

Hi,

I see your point but I think that the place where you put the .replace() is not the right one, because in that way we are changing the whole input - no matter what.

I have to take a moment and see where else I could put it. The markdown library that Jingo uses, provides a nice set of hooks where I could probably attach and make the correct manipulation.

I will leave this open, for now.

Thanks a lot for the fix!

@Flaxscrip
Copy link
Author

Definitely agree with you. I'm a bit of a rookie at node so I just made the simplest fix I could. I spent an hour looking at marked.js trying to figure out where I could fix it. In the end, I went with the cheap/easy workaround.

Great job on Jingo though. Awesome wiki engine. I'm planning to use it for one of my projects.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants