Search code examples
github-flavored-markdown

Using Github Markdown: How to get literal Pipe into a table


I am producing a cheat sheet using Unix commands and markdown. When I use a pipe in a Unix command I get an extra column. I can't seem to find the character to give a literal |. The pipe between ls and wc gives 4 columns.

Example:

| # | Command | Description |
|:--|:--------|:------------|
| 1. | ls | wc –l | count number of files in a directory. |

Tried: backslash, forward slash, single backtick, triple backtick, surround it with 2 spaces, **,<code> </code>,


Solution

  • adding backslash works:

    | # | Command | Description |
    |:--|:--------|:------------|
    | 1. | ls \| wc –l | count number of files in a directory. |