gpt4 book ai didi

markdown - kramdown 中的三级嵌套列表

转载 作者:行者123 更新时间:2023-12-01 12:34:44 27 4
gpt4 key购买 nike

我一直在尝试创建一个嵌套列表,如下所示(使用 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 而不是由生成的内联样式更简洁 Markdown 处理器来实现所需的列表格式,但我很好奇上述失败是否可能是我对 kramdown 的误用,或者可能是错误或设计决策。)

最佳答案

使它们全部有序列表

1. Do something.

2. Do something else.

1. If the reverse-Pi separation gauge is set to `OFF` you can follow
the following procedure.

1. Use the flux capacitor on Mondays, Tuesdays and Thursdays, but
only if you have not done so already.

2. Do not use the flux capacitor if it's raining, because the
universe will implode.

2 If the reverse-Pi separation gauge is set to `ON` then you
should follow Procedure 42.

3. Go back to doing things.

然后应用样式
li li{
list-style-type: lower-alpha;
}

li li li{
list-style-type: lower-roman;
}

MDN on CSS

关于markdown - kramdown 中的三级嵌套列表,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30803694/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com