我想在README.md
中插入表格以获取vscode
扩展名。我的代码如下:
* some title
| words | transform to | keepUpperCase is false | keepUpperCase is true |
|--------------------|--------------|------------------------|-----------------------|
| "XML HTTP request" | pascalCase | `XmlHttpRequest` | `XMLHTTPRequest` |
| "new customer ID" | camelCase | `newCustomerId` | `newCustomerID` |
github
和visual studio marketplace概述的结果如预期,但在vscode
开放的扩展概述中如下:
XmlHttpRequest
| XMLHTTPRequest
|
| “新客户ID”| camelCase | newCustomerId
| newCustomerID
|当我更改我的代码如下:
* some title
| words | transform to | keepUpperCase is false | keepUpperCase is true |
|--------------------|--------------|------------------------|-----------------------|
| "XML HTTP request" | pascalCase | `XmlHttpRequest` | `XMLHTTPRequest` |
| "new customer ID" | camelCase | `newCustomerId` | `newCustomerID` |
该表按预期呈现。但是我会以这种方式丢失文档层次结构。
我终于用内联html解决了这个问题:
* some title
<table>
<thead>
<tr>
<th>words</th>
<th>transform to</th>
<th>keepUpperCase is false</th>
<th>keepUpperCase is true</th>
</tr>
</thead>
<tbody>
<tr>
<td>"XML HTTP request"</td>
<td>pascalCase</td>
<td><code>XmlHttpRequest</code></td>
<td><code>XMLHTTPRequest</code></td>
</tr>
<tr>
<td>"new customer ID"</td>
<td>camelCase</td>
<td><code>newCustomerId</code></td>
<td><code>newCustomerID</code></td>
</tr>
</tbody>
</table>
Markdown有不同的风格,每种风格都有不同的呈现方式。
Visual Studio Code的内置Markdown引擎使用CommonMark中提到的https://code.visualstudio.com/docs/languages/markdown#_does-vs-code-support-github-flavored-markdown Markdown规范:
VS Code是否支持GitHub Flavored Markdown?
不,VS Code使用CommonMark库来定位markdown-it Markdown规范。 GitHub正朝着CommonMark规范迈进,您可以在这个update中阅读。
如Extending the Markdown preview中所述,如果您的目标是特定平台(在您的情况下为Github),您可以安装一个扩展,更改内置降价预览以匹配目标平台的样式。例如,您可以安装建议的Markdown Preview Github Styling,以便您的预览看起来与Github中的预览相同。