19

I have a table:

| YAY! | TABLE | \^^/ | 1-liner JSON column! |
| ---- | ----- | ---- | -------------------- |
| That |  has  | JSON | `{a: 1, b: 2, c: 3}` |
| Here |  is   | more | `{d: 4, e: 5, f: 6}` |

Is there any way for me to insert in multiline code blocks into a generated table cell?

Meredith
  • 2,617
  • 3
  • 26
  • 55

1 Answers1

24

Replace ` with <code> tags and use &nbsp; and <br>for indentation.

Similarly you can use <pre> tags instead of ```.

Jan Kaifer
  • 512
  • 3
  • 13
Meredith
  • 2,617
  • 3
  • 26
  • 55
  • 1
    `
    ` also works independently from `\`` or `` to force multiline cells. I've used/tested this in combination with `pandoc` converting `my.md` to `HTML`.
    – antiplex Aug 25 '16 at 07:18
  • I wasn't saying `` was necessary for multiline cells, that was for making sure code formatting still happened despite using HTML tags – Meredith Aug 25 '16 at 19:52
  • My intention wasn't saying you were either but to clarify for others that might not be aware of this fact! ;) Anyway, I've run across Problems when using ` ` and pandoc to convert my `.md` to `HTML` as pandoc escapes ` ` to `&nbsp;` which in turn gets displayed as **`Â`** in my browser. Did you ever come across such issues? To what formats are you converting your `.md` files and which tools are being used? – antiplex Aug 29 '16 at 06:34
  • Oh! that makes sense -- As you can see from the tags I asked this question back when I was working with the Apiary tool in their 1.x version. I've since moved on right as they rolled out 2.x ... it sounds like you want html-encoding to work in markdown when html-encoding is for HTML. Sorry I don't use pandoc enough to be of help – Meredith Aug 30 '16 at 21:18
  • 5
    You'll need to use `
    ` instead of `` for multiline code block inside table on github ;)
    – Fery W Dec 19 '16 at 10:20
  • 1
    Can't make it work guys, GitHub shows this code here on one line in a table cell,
    is hidden: `
    {
      showToday: false,
      showClear: false,
      showClose: false
    }
    ` Any ideas? Thanks!
    – tonix May 20 '20 at 11:47
  • @tonix Oh I make it work, you don't need `
    ` just only `
    `. You can find a working example in my repo: https://github.com/prettier/plugin-pug/blob/main/README.md
    – Shinigami Feb 12 '21 at 14:01