Markdown 具有管道表语法,但在某些情况下还不够。
| table | syntax | without multiline cell content |
因此,我们可以使用 HTML 表格标签。
<table>
<tr>
<td>
```csharp
const int x = 3;
const string y = "foo";
readonly Object obj = getObject();
```
</td>
<td>
```nemerle
def x : int = 3;
def y : string = "foo";
def obj : Object = getObject();
```
</td>
<td>
Variables defined with <code>def</code> cannot be changed once defined. This is similar to <code>readonly</code> or <code>const</code> in C# or <code>final</code> in Java. Most variables in Nemerle aren't explicitly typed like this.
</td>
</tr>
但是前段时间语法高亮被破坏了,这 wiki page现在看起来很丑。有想法该怎么解决这个吗?
请您参考如下方法:
您可以使用 <pre>
正如 teh_senaus 所说,在表格中。但是如果你这样做,语法高亮将不起作用......或者会吗?
通过随机实验,我发现 GitHub 允许使用 <pre lang="csharp">
指定它。 .这与 ```csharp
的效果相同。将语法高亮设置为 C#。
这在 GitHub 的帮助中心和 linguist 中都没有真正记录。的文档。但它有效,即使在 table 内部。
因此,对于您的示例表,新代码如下:
<table>
<tr>
<td>
<pre lang="csharp">
const int x = 3;
const string y = "foo";
readonly Object obj = getObject();
</pre>
</td>
<td>
<pre lang="nemerle">
def x : int = 3;
def y : string = "foo";
def obj : Object = getObject();
</pre>
</td>
<td>
Variables defined with <code>def</code> cannot be changed once defined. This is similar to <code>readonly</code> or <code>const</code> in C# or <code>final</code> in Java. Most variables in Nemerle aren't explicitly typed like this.
</td>
</tr>