Good way to embed a pipe character (i.e., '|') in a multi-markdown table?

I use DT to take a lot of programming related notes, and I’m surprised I haven’t run into this before. When I want to put programming code (i.e., delimited by back ticks) content in the cell of a multi-markdown table that contains a pipe character (i.e., |), what’s a good way to do this to make it play nicely? At first I thought escaping it might work (i.e., \|), but that doesn’t seem to work. Then I thought maybe I could use its HTML character code (i.e., &#124;), but that didn’t work either. Then I thought instead of ditching the back ticks and using explicit <code> and </code> tags, but that didn’t quite work either. Any thoughts?

I’m not sure why it’s working for you but not for me, but here’s what I get:

It seems to be going nuts on the pipe character deeply embedded in that AWS command.

The same question was asked about 9 years ago on Stack Overflow and kind of answered. It’s also briefly discussed on Github. That seems to be one of the cases where MD is pushed to its limits. You might be better off with a complete HTML table element here. OTHO (and from a more “typogaphical” standpoint): Is a table really a good place to post code? Even if you could easily embed the pipe character, the code is difficult to read and grasp if it’s broken up like that (i.e. arbitrarily split across lines). Look at the

--
filters

in the first row. That should be --filters, but as you are in a table, you can’t control where the line breaks happen. Not with simple MD anyway. I’d try to use another way to present the code, perhaps with a small heading and indented code below that.

1 Like

Fair enough. I’ve managed to make Markdown work for so many other things, but I do see this is quite the edge case.