Zia*_*iav 25 markdown html-table syntax-highlighting github github-flavored-markdown
Markdown具有管道表语法,但在某些情况下还不够.
| table | syntax | without multiline cell content |
Run Code Online (Sandbox Code Playgroud)
因此,我们可以使用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>
Run Code Online (Sandbox Code Playgroud)
但前段时间语法突出显示被破坏,这个维基页面现在看起来很难看.有想法该怎么解决这个吗?
Pok*_*u22 31
你可以<pre>在表中使用,就像teh_senaus所说的那样.但是,如果你这样做,语法高亮将不起作用......或者它会吗?
通过随机实验,我发现GitHub允许指定它<pre lang="csharp">.这与```csharp将语法高亮设置为C#的效果相同.
这在GitHub帮助中心的任何地方都没有记录,也没有在语言学家的文档中记录.但它可以工作,甚至在桌子内部.
因此,对于您的示例表,新代码如下:
<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>
Run Code Online (Sandbox Code Playgroud)
在<td>和 代码块之间添加一个空行。
这是固定的降价:
<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>
</table>
Run Code Online (Sandbox Code Playgroud)
结果: