claudioc / jingo

Node.js based Wiki
MIT License
1.02k stars 184 forks source link

Fix .md table pipe parsing #51

Open Flaxscrip opened 9 years ago

Flaxscrip commented 9 years ago

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.

claudioc commented 9 years ago

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 commented 9 years ago

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.