How to nest code block within a table cell using Markdown?

大城市里の小女人 提交于 2021-02-07 07:15:49

问题


I'd like write some multiline code in markdown table cells like this

|pointers|`int a;` <br> `int *pa = &a;`||

I've to write <br> at each line of the codes, Whether I can do this, i.e., using code blocks?

|pointers|```c  int a; int *pa = &a; ```||

回答1:


You can not do this efficiently/quickly. You could avoid using
however and format it like this :

| Pointers |
| -------- |
| `int a;` |
| `int *pa = &a;` |
| etc..  |

It does take more time, but I am aware that there is no alternate way to nest an entire code block. You can use the "```" method but it can only be single line.

Also generally make sure to have the |------| under the title of the table. It's also a good habit to get into indenting and spacing your code for clarity.



来源:https://stackoverflow.com/questions/30021157/how-to-nest-code-block-within-a-table-cell-using-markdown

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!