Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show pipe ( | ) sign in the Inline Code inside Table #1193

Closed
doggy8088 opened this issue May 1, 2018 · 7 comments
Closed

Show pipe ( | ) sign in the Inline Code inside Table #1193

doggy8088 opened this issue May 1, 2018 · 7 comments

Comments

@doggy8088
Copy link

doggy8088 commented May 1, 2018

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 '*'

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?

@doggy8088
Copy link
Author

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"

@yairEO
Copy link

yairEO commented Apr 11, 2020

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 `/,

@yairEO
Copy link

yairEO commented Apr 11, 2020

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/

@jonkiparsky
Copy link

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

@rauschma
Copy link

rauschma commented Aug 19, 2021

I’d prefer not having to escape pipe symbols:

@rauschma
Copy link

One more argument in favor of not escaping – elsewhere, `\|` is rendered as a backslash followed by a pipe: \|

Currently, moving such markup to a table means that the backslash will disappear.

@aremmell
Copy link

Bump!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants