0

我想使用 jekyll 创建一个包含项目编号列表的 HTML 文档;即<ol>在 HTML 中。有些项目包含一个表格。该列表在表格之后停止,但前提是我使用 jekyll,而不是直接使用 kramdown。

我正在运行 jekyll 版本 2.2.0 和 kramdown 版本 1.4.1。

为了重现这一点,我使用jekyll new that. 然后我创建一个名为的新降价文档this.md

---
layout: page
title: This
permalink: /this/
---

1. first

   |table|table|
   |-----|-----|
   |conte|nt   |

1. second
1. third

并运行jekyll serve

这会生成以下 HTML 代码http://localhost:4000/this/(仅引用相关部分):

  <ol>
  <li>first</li>
</ol>

<table>
  <thead>
    <tr>
      <th>table</th>
      <th>table</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>conte</td>
      <td>nt</td>
    </tr>
  </tbody>
</table>

<ol>
  <li>second</li>
  <li>third</li>
</ol>

这显然不是我想要的。跑步kramdown this.md给了我想要的东西:

<ol>
  <li>
    <p>first</p>

    <table>
      <thead>
        <tr>
          <th>table</th>
          <th>table</th>
        </tr>
      </thead>
      <tbody>
        <tr>
          <td>conte</td>
          <td>nt</td>
        </tr>
      </tbody>
    </table>
  </li>
  <li>second</li>
  <li>third</li>
</ol>

即我想要一个<ol>包含多个项目的列表,而不是每个表之后的新列表。

jekyll 有什么不同?我该如何解决这个问题?

4

1 回答 1

2

kramdown doc所示,多行列表很棘手,您需要调整 list 和 table 的缩进:

1. first (0 space indentation) NOT WORKING

   |table|  - 3 spaces indent|
   |-----|-----|
   |conte|nt   |

2. second (0 space indentation) NOT WORKING

    |table|  - 4 spaces indent|
    |-----|-----|
    |conte|nt   |

 3. third (1 space indentation) NOT WORKING

   |table|  - 3 spaces indent|
   |-----|-----|
   |conte|nt   |

 4. fourth (1 space indentation) **WORKS GOOOOOD !!**

    |table|  - 4 spaces indent|
    |-----|-----|
    |conte|nt   |


 5. fifth - tip of the day - add a class to table

    {:.table}
    |table|  - 4 spaces indent|
    |-----|-----|
    |conte|nt   |
于 2014-08-12T13:17:02.487 回答