16

I just wrote an answer which contained the sentence

You need an IQueriable<TypeA>, but you have an IQueriable<TypeB>

Upon posting, the "invalid markdown tags" where silently deleted, so the actual post contained

You need an IQueriable, but you have an IQueriable

which sounds like a madman talking.

Sometime later I discovered the error, and added backticks, which is probably the correct way to format it
( You need an IQueriable<TypeA>, but you have an IQueriable<TypeB> )

Not too sure whether it adds to readability if every variable and type name in a paragraph has a different font and shading than the surrounding text, but I digress. Escaping each bracket with &lt; and &gt; is of course possible too.

But could we please have a warning when an invalid markdown tag is detected, instead of silently removing part of the answer?

enter image description here This obviously will not help if the answer contains only valid markdown tags, which are not intended as markdown tags, but it would not hurt in that case either.

  • 6
    Indeed, you need an IQueryable, not an IQueriable. – BoltClock's a Unicorn Dec 17 '13 at 16:50
  • 3
    They're not removed, they're just not escaped. – Dave Newton Dec 17 '13 at 16:50
  • So I can put arbitrary html tags inside an answer? I doubt that. Clearly the server removes them before sending the html to the browser – HugoRune Dec 17 '13 at 16:51
  • 1
    @HugoRune Some HTML works. The rest is silently removed. – Manishearth Dec 17 '13 at 17:03
  • 4
    Yeah, I am kinda objecting to the silent part :). Of course if there are only valid and correctly closed tags like <pre></pre>, it is not possible to detect whether the intention was to escape them. But the vast majority of unintentional tags should be simple to detect before submitting, with some client-side javascript – HugoRune Dec 17 '13 at 17:04
  • 1
    Yep, I just ran into this too. This is totally what "did you mean this?" popup warnings are for - if the user wants to just hit yes without reading it, it'll still post, and that's their fault. – neminem Dec 17 '13 at 17:20
  • This is an issue in the XML tag as well. Someone posts a block of XML without putting in a code block, it doesn't appear and usually only leads to confusion – psubsee2003 Dec 17 '13 at 17:25
  • 1
    They should use regex to scan for incomplete HTML blocks – user206222 Dec 17 '13 at 17:26
  • 1
    SILENCE WILL FALL @HugoRune ! – qwertynl Dec 17 '13 at 18:45
  • @HugoRune how do you handle public class A<B> { ... used in an example that was just dumped in there without the backticks? – user213963 Dec 17 '13 at 18:57
  • Well, that is exactly the case shown in the example image (Kindly provided by Mr. Peanut Monopoly McManish): Display a short warning to the user, reminding them that they either need to add backticks, indent the code or escape the brackets with html entities, if they want their post to make any sense. – HugoRune Dec 17 '13 at 19:03
  • @HugoRune Not quite, my generic class name (B) happens to be a valid html entity (<B>) in an answer. Alterativelly, what if I want to use <b> (or <br> - I do that frequently) as raw html for some reason (which is valid)? The other bit to consider, people currently post large code blocks without ever caring about how it looks. A popup likely won't make them care any more. – user213963 Dec 17 '13 at 19:06
  • I see your point now. As I said the warning should only appear if there are angle brackets that are not part of valid markdown snytax. This obviously will not help if the answer contains only valid markdown tags, which are not intended as markdown tags, but it would not make it worse than it currently is. As a bonus you could also provide the warning for valid but incorrectly closed markdown tags, which would cover this particular case. But since the number of html tags that are allowed in markdown is very limited, the vast majority of cases could be covered by a simple whitelist – HugoRune Dec 17 '13 at 19:11

You must log in to answer this question.

Browse other questions tagged .