5

This is a very minor bug, but I still think it is important to point it out (maybe it was already).

I voted another question to be closed as duplicate of PHP preg_replace \

Since the title ends with a backslash, the text generated is:

enter image description here

which results in

enter image description here

Though, linking to the question in this question (by just inserting the link) obviously creates an appropriate link. Maybe this automatic link detection / title creation should be done for comments as well, to avoid this issue (which I admit is a minor case)?

(Unfortunately it does not look like escaping the backslash (\\) helps in any way).

Other problematic characters:

9
  • 7
    Alright, that's it, NO MORE MARKDOWN. Straw, camel, etc., you ruined it for everyone....no more network, sorry folks. Also, in light of these bug reports we're renaming it to MarkdownDull, since we're closing up shop can won't be fixing said bugs, etc. Commented Apr 2, 2012 at 10:47
  • Ok... I will go home then :-/ Sorry for ruining everyones day... Commented Apr 2, 2012 at 10:47
  • Test: possible duplicate of php preg_replace \ Commented Apr 2, 2012 at 10:50
  • \\ test \\ test [test \](enwp.org) Commented Apr 2, 2012 at 10:53
  • [this ends with an escaped backslash (\\) \](meta.stackexchange.com/questions/127832/…). Commented Apr 2, 2012 at 11:03
  • 1
    @Nick I don’t get it. It’s not Markdown that’s at fault here, it’s the fact that the comments don’t use (full-blown) Markdown. After all, it works the normal text. Commented Apr 2, 2012 at 11:11
  • @Konrad - Nor should they, the issue is that the title is not properly escaped for markdown mini, will take a look after the gym. Commented Apr 2, 2012 at 11:40
  • [Link with trailing space ](meta.stackexchange.com/questions/127832/…). Commented May 7, 2012 at 9:07
  • 1
    In regards to the whitespace: Auto-inserted "possible duplicate" comment does not trim whitespace from question title Commented May 7, 2012 at 13:08

1 Answer 1

2

I "fixed" this a long time ago. Scare quotes because I cheated; here's the relevant snippet from the code:

public static class MarkdownMaker { /// <summary> /// Returns a [markdown](http://link) that, when run through markdown, creates HTML /// where linkText is displayed exactly as given. In other words, an asterisk in linkText /// is visible as an asterisk to the user (and cannot cause unwanted italicization), /// a closing bracket in linkText doesn't break the link, but is actually visible as /// a closing bracket, etc. If markdownMini is true, it's for putting it in comments, /// otherwise it's for posts. /// </summary> public static string Link(string linkText, string url, bool markdownMini) { // ... if (markdownMini) { // ... // there is absolutely no way to end a comment link with a backslash // -- it would always escape the closing "]". So we're using an ugly // unicode hack -- U+2216 is Set Minus, which looks closest to a regular // backslash if (linkText.EndsWith(@"\")) linkText = linkText.Substring(0, linkText.Length - 1) + "\u2216"; // ... } 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.