How to convert asciidoc to markdown

It turns out that converting AsciiDoc to HTML without including a bunch of undesired CSS is a problem, and converting AsciiDoc to Markdown is also a problem. The page I linked to shows the best way I’ve found to convert AsciiDoc to Markdown, which can then be converted to CSS-free HTML. In case that page ever disappears, the basic commands are:

Install pandoc and asciidoc:

sudo apt install pandoc asciidoc

Convert asciidoc to docbook:

asciidoc -b docbook foo.adoc

Convert docbook to markdown:

pandoc -f docbook -t markdown_strict foo.xml -o foo.md

In my case, my commands were:

# convert asciidoc to docbook
asciidoc -b docbook 100-strings.adoc

# convert docbook to markdown
pandoc -f docbook -t markdown_strict 100-strings.xml -o 100.md

Hopefully there is a simpler way to convert AsciiDoc to HTML without CSS, but I haven’t found it yet.

I should note that I’m looking into AsciiDoctor as well as AsciiDoc.

Update

If you’re interested in HTML as the end result, I just created a Scala shell script to convert AsciiDoc to HTML. It creates very clean HTML as the end result.

Category