Are numbered headings in Markdown / Rdiscount possible?
If your markdown tool supports customized theme by CSS, add below snippet into CSS to enable heading number:
body {
counter-reset: h1
}
h1 {
counter-reset: h2
}
h2 {
counter-reset: h3
}
h3 {
counter-reset: h4
}
h1:before {
counter-increment: h1;
content: counter(h1) ". "
}
h2:before {
counter-increment: h2;
content: counter(h1) "." counter(h2) ". "
}
h3:before {
counter-increment: h3;
content: counter(h1) "." counter(h2) "." counter(h3) ". "
}
h4:before {
counter-increment: h4;
content: counter(h1) "." counter(h2) "." counter(h3) "." counter(h4) ". "
}
I use Typora, which supports auto numbering for headings in this approach.
Yes, try Pandoc. This works for me:
pandoc --number-sections < test.md > out.html
(Source)
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
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.
Update 2015-10-18: Markdeep has numbered headings (and many other fancy features). Check that out too!