问题描述
我正在尝试使用类似以下内容的小节/小节标题来生成html:
I'm trying to produce html with section / subsection headings resembling the following:
- 我的顶级话题
1.1我的第一个子主题
1.2另一个子主题
1.2.1子子主题 - 另一个顶级主题
- My top-level topic
1.1 My first subtopic
1.2 Another subtopic
1.2.1 A sub-subtopic - Another top-level topic
是否有Markdown的实现能够产生这种编号的节标题?
Are there any implementations of Markdown capable of producing these kinds of numbered section headings?
谢谢.
推荐答案
是的,请尝试 Pandoc .这对我有用:
Yes, try Pandoc. This works for me:
pandoc --number-sections < test.md > out.html
(来源)
Markdown生成您在原始帖子中提到的编号轮廓,如下所示:
Markdown to produce the numbered outline you mention in the original post looks like this:
# My top-level topic
## My first subtopic
## Another subtopic
### A sub-subtopic
## Another top-level topic
如果您想对子节进行更深入的缩进,则可以使用内联CSS来实现.例如,将其放在上述Markdown源的顶部会使标题缩进:
If you want deeper indenting for sub-sections, you might be able to achieve this with inline CSS. For example, placing this at the top of the above Markdown source indents the headers:
<style type="text/css">
h2 { margin-left: 10px; }
h3 { margin-left: 20px; }
</style>
但是说您的标题下有几段文字...我不知道如何将其缩进与上述标题相同的水平.
But say you had paragraphs of text under your headings... I don't know how to indent that to the same level as the above header.
更新2015-10-18 : Markdeep 带有编号的标题(以及许多其他精美功能).也检查一下!
Update 2015-10-18: Markdeep has numbered headings (and many other fancy features). Check that out too!
这篇关于Markdown/Rdiscount中的编号标题可能吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!