Last Updated: April 30, 2016
·
1.519K
· mojavelinux

Markdown headings in AsciiDoc

So you're converting your Markdown document to AsciiDoc, but you don't want to change all your headings. You don't have to!

In the same directory as your document, create either an asciidoc.conf file or a docname.conf file (where docname is the name of your document without the extension), then populate it with the following content:

[titles]
sect0=^(=|#) +(?P<title>[\S].*?)(?: +\1)?$
sect1=^(==|##) +(?P<title>[\S].*?)(?: +\1)?$
sect2=^(===|###) +(?P<title>[\S].*?)(?: +\1)?$
sect3=^(====|####) +(?P<title>[\S].*?)(?: +\1)?$
sect4=^(=====|#####) +(?P<title>[\S].*?)(?: +\1)?$

Now you can type headings the Markdown way:

# Document Title
## Heading 1
### Heading 2
#### Heading 3
##### Heading 4

or the AsciiDoc way:

= Document Title
== Heading 1
=== Heading 2
==== Heading 3
===== Heading 4

It's up to you :)

NOTE: This will be the default behavior in Asciidoctor, so no configuration will be necessary.