6

Within a <PRE> block, &para turns into a new paragraph symbol:

I use <PRE> blocks for code when I want to bold, so a function that's written

void go( ObjectA &parameter1, ObjectB &parameter2 ) { }

Comes out as:

void go( ObjectA ¶meter1, ObjectB ¶meter2 ) { }

What's the dilly-yo

4
  • 1
    What's the use case for bold in code blocks? I've never wanted that. And everything works just fine if you use markdown... Commented Aug 4, 2011 at 13:42
  • 1
    @Cody Bold in code blocks is useful to highlight specific things, and there were several feature requests to have it meta.stackexchange.com/questions/32705/bold-code-in-a-question meta.stackexchange.com/questions/54392/… meta.stackexchange.com/questions/97383/… Commented Aug 4, 2011 at 14:16
  • 4
    @Daniel: Oh goodness, let's not do that. We'll get a whole bunch of questions from the gruff C and C++ communities complaining that using pointers now make their entire code blocks render in bold. I don't understand what's wrong with using comments to highlight specific things. You shouldn't be posting so much code that we need bold to see what to focus on in the first place. Commented Aug 4, 2011 at 14:21
  • 1
    <PRE> block is meant to display HTML and that's exactly what it's doing.. so it's not a bug. You might change it to feature request, asking to encode HTML entities inside <pre> sections. Commented Aug 4, 2011 at 14:43

2 Answers 2

14

This is expected, since the browser thinks that it knows better than you do.

No conversion is done inside of raw HTML blocks by the Markdown parser, which means that your & isn't encoded to &amp; before being inserted into the HTML. Even though both the client and server-side parser return the literal &para in the source, the browser decides that you meant &para;, and renders ¶ instead.

If you're going to use raw HTML, you need to make sure you properly escape your entities manually:

<pre>
&amp;para
</pre>

generates

&para
4
  • 6
    actually, not "the browser thinks that it knows better than you do", but "markdown thinks you know better than it" :)
    – balpha StaffMod
    Commented Aug 4, 2011 at 16:03
  • True, although the browser is also being liberal in deciding what's an entity (since there's no ; there). Technically if it's using SGML rules, the first case could be considered valid, but the &parameter is just wrong.
    – Tim Stone
    Commented Aug 4, 2011 at 16:07
  • No, the "browser does know better than you do". If it didn't, bobobobobobo would have written &amp; in the first place!
    – SamB
    Commented Feb 7, 2012 at 1:05
  • Worked like charm! :) Was breaking my head with &para symbol for so long.
    – Nariman
    Commented Apr 7, 2014 at 10:12
-1

Or use &Parameter1 (captial P) to avoid this unwanted replacement

1
  • Many programming languages are case-sensitive, and a fair few have opinions about proper parameter casing. Commented Mar 13, 2017 at 22:00

You must log in to answer this question.

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