What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

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:

share|improve this question
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. –  Nick Craver Apr 2 '12 at 10:47
Ok... I will go home then :-/ Sorry for ruining everyones day... –  Felix Apr 2 '12 at 10:47
Test: possible duplicate of php preg_replace \ –  Manishearth Apr 2 '12 at 10:50
\\ test \\ test [test \](enwp.org) –  Manishearth Apr 2 '12 at 10:53
[this ends with an escaped backslash (\\) \](meta.stackexchange.com/questions/127832/…). –  Felix Apr 2 '12 at 11:03
@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. –  Konrad Rudolph Apr 2 '12 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. –  Nick Craver Apr 2 '12 at 11:40
[Link with trailing space ](meta.stackexchange.com/questions/127832/…). –  Felix May 7 '12 at 9:07

1 Answer 1

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";

        // ...

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .