Markup: Show pipe ( | ) sign in the Inline Code inside Table

Created on 1 May 2018  ·  4Comments  ·  Source: github/markup

Here are my few trials below:

Table 1: There is a pipe ( | ) character inside Table Cell. It can't display properly.

| Alias | Command | What to Type |
| --- | --- | --- |
| git cleanup | git branch --merged | grep -v '*' | xargs git branch -d | git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d" |

Table 2: There is a pipe ( | ) character that escape with a HTML Entity ( | ). Within ` sign, all HTML Entities will output ASIS which is not what I want.

| Alias | Command | What to Type |
| --- | --- | --- |
| git cleanup | git branch --merged | grep -v '*' | xargs git branch -d | git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d" |

Table 3: When I strip the ` sign, it works, but not what I want. Using this, we also need to escape the * symbol to |.

| Alias | Command | What to Type |
| --- | --- | --- |
| git cleanup | git branch --merged | grep -v '*' | xargs git branch -d | git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d" |

Table 4: This is the best solution I can figure out. It's just not perfect!

| Alias | Command | What to Type |
| --- | --- | --- |
| git cleanup | git branch --merged | grep -v '*' | xargs git branch -d | git config --global alias.cleanup "!git branch --merged | grep -v '*' | xargs git branch -d" |

Is there a better way to show | sign in the Table Cell with Inline Code syntax in a Markdown document?

Most helpful comment

@yairEO That's a backslash, not a slash!

All 4 comments

I found the right way to escape pipe character. 😃

Table 5: Extreme solution! Ref: GitHub Flavored Markdown Spec - Example 193

| Alias | Command | What to Type |
| --- | --- | --- |
| git cleanup | git branch --merged \| grep -v '*' \| xargs git branch -d | git config --global alias.cleanup "!git branch --merged | grep -v '*' \| xargs git branch -d" |

I didn't get it, how did you manage?

I don't see how the example linked solved it and I cannot see the markdown source of your working table in the last comment, only the rendered result :/

(showing the markdown with <pre> tags around it)

Name         | Type         | Default           
------------ | ------------ | ----------------- 
xxx          | xxx          | `/,|\.|\:|\s/`

outputs:

Name | Type | Default
------------ | ------------ | -----------------
xxx | xxx | /,|\.|\:|\s/

Ok I see now from this discussion in stackoverflow you should escape the pipe characters with a leading backslash \:

/,\|\.\|\:\|\s/

Name | Type | Default
------------ | ------------ | -----------------
xxx | xxx | /,\|\.\|\:\|\s/

@yairEO That's a backslash, not a slash!

Was this page helpful?
0 / 5 - 0 ratings