Is there a lightweight markup language that supports numbered headings?

172 Views Asked by At

Languages like Creole, reStructuredText, Markdown, and others allow headings

= Food
== Fruit
=== Apples

and numbered lists

# Food
# Food 2

but I want something that can give me headings I can refer to by number.

Like this type of output:

1. Food
1.1. Fruit
1.2. Vegetables

Are there any that can do this?

1

There are 1 best solutions below

1
Stephen Thomas On

To provide a specific example following up on my comment, consider the options available for pandoc:

-N, --number-sections Number section headings in LaTeX, ConTeXt, HTML, or EPUB output. By default, sections are not numbered. Sections with class unnumbered will never be numbered, even if --number-sections is specified.

--number-offset=NUMBER[,NUMBER,…] Offset for section headings in HTML output (ignored in other output formats). The first number is added to the section number for top-level headers, the second for second-level headers, and so on. So, for example, if you want the first top-level header in your document to be numbered “6”, specify --number-offset=5. If your document starts with a level-2 header which you want to be numbered “1.5”, specify --number-offset=1,4. Offsets are 0 by default. Implies --number-sections.

So do you want LaTeX, ConTeXt, HTML, or EPUB output? If so, then any of the languages pandoc supports will do. ( markdown, reStructuredText, textile, HTML, DocBook, LaTeX, MediaWiki markup, TWiki markup, OPML, Emacs Org-Mode, Txt2Tags, Microsoft Word docx, LibreOffice ODT, EPUB, or Haddock markup)