jingo icon indicating copy to clipboard operation
jingo copied to clipboard

Fix .md table pipe parsing

Open Flaxscrip opened this issue 10 years ago • 2 comments

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.

Flaxscrip avatar Oct 02 '14 15:10 Flaxscrip

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!

claudioc avatar Oct 02 '14 18:10 claudioc

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.

Flaxscrip avatar Oct 02 '14 19:10 Flaxscrip