-2

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?

Richard
  • 14,798
  • 21
  • 70
  • 103
  • 1
    Perhaps [this](http://stackoverflow.com/questions/19999696/are-numbered-headings-in-markdown-rdiscount-possible) will be of use to you? – Brynden Oct 19 '16 at 16:45
  • Your question doesn't make sense. Any of the languages you mention could be rendered with numbered headings. Whether or not the heading is numbered in the output isn't a function of the language; it's a function of whatever tool you're using to convert the markup to output. So what you really want is an application/library/whatever that has the option of numbered headings. No doubt there are several, but which would be appropriate for you depends on what output format you need and what you want to do with it. – Stephen Thomas Oct 19 '16 at 16:55
  • And asking for software/language recommendations is EXPLICITLY off-topic anyways. – Marc B Oct 19 '16 at 17:02
  • Thanks Brynden, your link to Markdeep seems to be the same question I have. – Richard Oct 19 '16 at 17:09
  • The problem is that HTML does not offer numbered headings (unless you manually add the numbers yourself). Therefore, the various lightweight markup languages that render to HTML do not offer that feature. Those languages are a subset of HTML, not a superset. – Waylan Oct 19 '16 at 17:46

1 Answers1

2

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)

Stephen Thomas
  • 13,843
  • 2
  • 32
  • 53
  • Kindof. It's true that any of the languages could be rendered with numbered headings, in the same way that HTML could be rendered as musical notes. But that's not how the language was defined - I don't want to add plugin functionality to a language. Brynden's link to Markdeep above looks like the only language that has numbered headings natively. – Richard Oct 19 '16 at 17:08