gpt4 book ai didi

markdown - 如何并排显示两个 Markdown 代码块

转载 作者:行者123 更新时间:2023-12-02 16:09:00 26 4
gpt4 key购买 nike

我想并排显示源代码的两个 block - 重构之前和之后。是否可以并排创建两个代码块?如果不是,那么替代解决方案是什么?

最佳答案

无法使用纯 Markdown 语法在单个表格单元格中创建多行代码块 - 但您可以使用逐字 HTML 来完成此操作。下面是一个带有并排代码的两列表格示例(请注意,此 HTML 与 Markdown 的其余部分并排):

# Document Title

The usual [Markdown Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet)
does not cover some of the more advanced Markdown tricks, but here
is one. You can combine verbatim HTML with your Markdown.
This is particularly useful for tables.
Notice that with **empty separating lines** we can use Markdown inside HTML:

<table>
<tr>
<th>Json 1</th>
<th>Markdown</th>
</tr>
<tr>
<td>
<pre>
{
"id": 1,
"username": "joe",
"email": "joe@example.com",
"order_id": "3544fc0"
}
</pre>
</td>
<td>

```json
{
"id": 5,
"username": "mary",
"email": "mary@example.com",
"order_id": "f7177da"
}
```

</td>
</tr>
</table>

渲染为:

two-column table in markdown

关于markdown - 如何并排显示两个 Markdown 代码块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35381425/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com