How to convert Asciidoc to HTML

As a brief note to self, if you need to convert an Asciidoc file named test1.adoc to HTML format, this command works:

asciidoc -o test1.html test1.adoc

Of course a key here is that you need the asciidoc command installed. I installed it on my Mac with Homebrew, something like brew install asciidoc. I don’t like the HTML that this approach generates, so I’ll keep looking for something better.

Update: Something better

I just found a better way to do this with AsciiDoctor:

asciidoctor -a stylesheet! myfile.adoc

This command creates a converted output file named myfile.html that includes a lot of CSS styling that I don’t want/need — for instance, it wraps every <p> with a <div class="paragraph"> — but at least the rest of the HTML seems like something I can work with.

Update 2: Something even better!

Best solution yet: I just created a Scala shell script to convert AsciiDoc to HTML.

Add new comment

The content of this field is kept private and will not be shown publicly.

Anonymous format

  • Allowed HTML tags: <em> <strong> <cite> <code> <ul type> <ol start type> <li> <pre>
  • Lines and paragraphs break automatically.