如何在 vscode 分机的 README.md 中插入表格?

How to insert tables in README.md of vscode extension?

我想在 README.md 中插入 table 用于 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 市场概览中的结果符合预期,但 vscode 打开的扩展概览中的结果如下:

当我如下更改代码时:

* some title

| words              | transform to | keepUpperCase is false | keepUpperCase is true |  
|--------------------|--------------|------------------------|-----------------------|  
| "XML HTTP request" | pascalCase   | `XmlHttpRequest`       | `XMLHTTPRequest`      |  
| "new customer ID"  | camelCase    | `newCustomerId`        | `newCustomerID`       |  

table 按预期呈现。但是这样我会丢失文档层次结构。

有不同风格的 Markdown,每一种都可以不同地呈现。

Visual Studio的内置Markdown引擎代码使用CommonMark Markdown specification as mentioned in https://code.visualstudio.com/docs/languages/markdown#_does-vs-code-support-github-flavored-markdown:

Does VS Code support GitHub Flavored Markdown?

No, VS Code targets the CommonMark Markdown specification using the markdown-it library. GitHub is moving toward the CommonMark specification which you can read about in this update.

Extending the Markdown preview, if you are targeting a specific platform (Github in your case), you can install an extension that changes the built-in markdown preview to match the target platform's styling. For example, you can install the suggested Markdown Preview Github Styling 中所述,以便您的预览看起来与 Github 中的相同。

我终于用内联解决了问题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>