Community @ The Turning Gate

Support community for TTG plugins and products.

NOTICE

The Turning Gate's Community has moved to a new home, at https://discourse.theturninggate.net.

This forum is now closed, and exists here as a read-only archive.

  • New user registrations are disabled.
  • Users cannot create new topics.
  • Users cannot reply to existing topics.

You are not logged in.

#1 2014-09-17 17:38:01

richam
Member
From: Preveza, Greece
Registered: 2013-01-06
Posts: 143
Website

Markdown backslash escape not working

In trying to use markdown to specify a link with a URL that has embedded parentheses, I tried to use the "\" escape before the final parenthesis to avoid mis-interpretation of the ")" as a markdown control character.  Using MOU translation to HTML, it worked.  But when the markdown is translated on the site, the link is faulty.  Here is the actual markdown text from my fragments folder:

[Gardelegen War Crime Wikipedia](http://tinyurl.com/my6kala)
[Gardelegen War Crime Wikipedia](http://en.wikipedia.org/wiki/Gardelegen_(war_crime\))

Here is the page in question: http://www.michaelrichardsphotography.com/services.php

I solved the problem with tinyURL, but left both links on the site in case you want to check them out.  There are two "Gardelegen War Crime Wikipedia" links.  The first works, the second does not.

I've had several email exchanges with the MOU CEO, Chen Luo.  He claims his software is doing the markdown translation right, and it would seem so according to the Daring Fireball Syntax document.  I'm not sure what engine TTG is using, but it may be worth looking into.

Offline

#2 2014-09-17 18:17:10

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Markdown backslash escape not working

I would just use HTML for that particular link.


Matt

The Turning Gate, http://theturninggate.net

Offline

#3 2014-09-17 18:47:18

richam
Member
From: Preveza, Greece
Registered: 2013-01-06
Posts: 143
Website

Re: Markdown backslash escape not working

Matt, there's another solution - reference link. They are delineated by spaces and/or return.

These are the actual markdown lines from fragments:
* [Gardelegen War Crime Wikipedia](http://tinyurl.com/my6kala)
* [Gardelegen War Crime Wikipedia](http://en.wikipedia.org/wiki/Gardelegen_(war_crime\))
* [Gardelegen War Crime Wikipedia] [1]
[1]: http://en.wikipedia.org/wiki/Gardelegen_(war_crime)

Again, here's the URL if you want to check it:  http://www.michaelrichardsphotography.com/services.php

The third link works just fine.  It seems this is a better solution since I like to keep everything in markdown for readability purposes.  The tinyURL depends on their website and may cause processing time or other future problems.

Last edited by richam (2014-09-17 18:48:40)

Offline

#4 2014-09-17 19:02:35

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Markdown backslash escape not working

And the second, without the escape character, doesn't work?

Pages is using Parsedown, so I guess the problem is there.


Matt

The Turning Gate, http://theturninggate.net

Offline

#5 2014-09-17 23:38:46

richam
Member
From: Preveza, Greece
Registered: 2013-01-06
Posts: 143
Website

Re: Markdown backslash escape not working

Matt, The second one doesn't work with or without the escape backslash.  Apparently the Parsedown engine picks up the embedded ")" as a Markdown termination.  I've even tried escape on both parentheses, same problem.  It appears that Parsedown is the problem, since it works with MOU.

Offline

#6 2014-09-17 23:57:30

richam
Member
From: Preveza, Greece
Registered: 2013-01-06
Posts: 143
Website

Re: Markdown backslash escape not working

Matt, I tried with the Parsedown on line Demo, and the problem is obvious:

Input:
ParsedownInput.png

Output:
ParsedownOutput.png

In the first case, the "\" is taken as the end of the URL, and the ")" is moved outside the generated HTML.  In the second one, again the ")" is again moved outside the HTML.  The third one is correct and it works.

Last edited by richam (2014-09-18 00:10:06)

Offline

#7 2014-09-18 04:55:45

Daniel Leu
Moderator
Registered: 2012-10-11
Posts: 1,624
Website

Re: Markdown backslash escape not working

As a quick fix, you can use 'URL encoding' for the embedded parenthesis:

[Gardelegen War Crime Wikipedia](http://en.wikipedia.org/wiki/Gardelegen_%28war_crime%29)

Daniel Leu | Photography   
DanielLeu.com
My digital playground (eg, Backlight tips&tricks): lab.DanielLeu.com

Offline

#8 2014-09-18 13:38:15

Matthew
Administrator
From: San Francisco, CA
Registered: 2012-09-24
Posts: 5,795
Website

Re: Markdown backslash escape not working

That's a good idea, Daniel. Nice one!

Michael, it might be worth posting about your issue on Parsedown's Github:
https://github.com/erusev/parsedown/issues


Matt

The Turning Gate, http://theturninggate.net

Offline

#9 2014-09-18 16:52:47

richam
Member
From: Preveza, Greece
Registered: 2013-01-06
Posts: 143
Website

Re: Markdown backslash escape not working

Daniel, Absolutely brilliant!  Thanks.

Matt, good suggestion.  I joined github and reported the problem.

Offline

Board footer

Powered by FluxBB