Posted by mojavelinux on URL: https://discuss.asciidoctor.org/Re-Table-of-contents-need-some-AST-code-tp4102.html
This may have been discussed before -- an "Asciidoc backend". It should
be very easy to write as an extension
I've experimented with creating such a converter, but haven't gotten around to publishing anything yet. It turns out, some parts are simple, other parts are pretty complex. Mostly whitespace is a challenge. It turns out to be quite similar to the manpage backend (see https://github.com/asciidoctor/asciidoctor/blob/master/lib/asciidoctor/converter/manpage.rb). I think we still need changes to the API to make is truly easy.
Another approach, which I think is more complete atm, is to convert to DocBook, then use docbookrx to convert to AsciiDoc.
> So why am I getting html when I apply #content?
Your backend must be set to html5, which is the default.