【发布时间】:2015-06-12 12:57:19
【问题描述】:
我一直在尝试创建一个如下所示的嵌套列表(使用 kramdown,用于 GitHub 页面),但 HTML 输出不是语义的;二级列表使用段落代替列表元素,三级列表项使用代码块。
1. Do something.
2. Do something else.
a. If the reverse-Pi separation gauge is set to `OFF` you can follow
the following procedure.
i. Use the flux capacitor on Mondays, Tuesdays and Thursdays, but
only if you have not done so already.
ii. Do not use the flux capacitor if it's raining, because the
universe will implode.
b. If the reverse-Pi separation gauge is set to `ON` then you
should follow Procedure 42.
3. Go back to doing things.
上面生成了以下 HTML...
<ol>
<li>
<p>Do something.</p>
</li>
<li>
<p>Do something else.</p>
<p>a. If the reverse-Pi separation gauge is set to <code>OFF</code> you can follow
the following procedure.</p>
<pre><code> i. Use the flux capacitor on Mondays, Tuesdays and Thursdays, but
only if you have not done so already.
ii. Do not use the flux capacitor if it's raining, because the
universe will implode.
</code></pre>
<p>b. If the reverse-Pi separation gauge is set to <code>ON</code> then you
should follow Procedure 42.</p>
</li>
<li>
<p>Go back to doing things.</p>
</li>
</ol>
我已尝试更改缩进甚至删除项目之间的空白行,但无法使其按预期工作。
用1.而不是它们的实际数字替换所有列表“子弹”确实可以生成结构正确的HTML(感谢Scroog1离线建议);然后可以使用 CSS 使输出的 HTML 列表具有所需的list-style-type。但是,这感觉与 Markdown 的 "it should be readable as plain text" philosophy 相反,所以我想知道是否有任何方法可以使其工作并且在 Markdown 版本中看起来像预期的那样?
(我想可以说,在这种特殊情况下,HTML 是我的文档的唯一格式,人们会阅读,最好让机器进行编号,并且使用 CSS 而不是内联样式更简洁由降价处理器生成以实现所需的列表格式,但我很好奇上述失败是否可能是我对 kramdown 的滥用,或者可能是错误或设计决策。)
【问题讨论】:
标签: markdown github-pages kramdown