How to escape a pipe char in a code statement in a markdown table?

As of March 2017 using escaped pipes is much easier: \| See other answers.

If you remove the backticks (`), using the | hack works

      a     |  r  
------------|-----
 `a += x;`  |  r1
 a |= y;  |  r2

and produces the following output

enter image description here

Alternatively, you can replace the backticks (`) with a <code></code> markup which fixes the issues more nicely by preserving the rendering

      a     |  r  
------------|-----
 `a += x;`  |  r1
<code>a &#124;= y;</code>  |  r2

generating the following output

enter image description here

Leave a Comment