Convert to HTML using the CLI

Asciidoctor’s default output format is HTML.

html5

HTML 5 markup styled with CSS3.

In this section, we’ll create a sample document, then process and convert it with Asciidoctor’s html5 converter.

  1. Create an AsciiDoc file like the one below

  2. Save the file as my-sample.adoc

= My First Experience with the Dangers of Documentation
:url-wolpertinger: https://en.wikipedia.org/wiki/Wolpertinger

In my world, we don't have to worry about mutant, script-injecting warlocks.
No.
We have something far worse.
We're plagued by Wolpertingers.

== Origins

You may not be familiar with these {url-wolpertinger}[ravenous beasts],
but, trust me, they'll eat your shorts and suck the loops from your code.

To convert my-sample.adoc to HTML from the command line:

  1. Open a console

  2. Switch to the directory that contains the my-sample.adoc document

  3. Call the Asciidoctor processor with the asciidoctor command, followed by the name of the document you want to convert

$ asciidoctor my-sample.adoc

Remember, Asciidoctor’s default converter is html5, so it isn’t necessary to specify it with the -b command.

You won’t see any messages printed to the console. If you type ls or view the directory in a file manager, there is a new file named my-sample.html.

$ ls
my-sample.adoc  my-sample.html

Asciidoctor derives the name of the output document from the name of the input document.

Open my-sample.html in your web browser. Your document should look like the image below.

fix ex

The document’s text, titles, and link is styled by the default Asciidoctor stylesheet, which is embedded in the HTML output. As a result, you could save my-sample.html to any computer and it will look the same.