summaryrefslogtreecommitdiff
path: root/docs/modules/get-started/pages/index.adoc
blob: d3ce8006fcd520fd9b533f188f48fb6ca58606b2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
= Convert Your First AsciiDoc File
:navtitle: Convert Your First File

Assumptions:

* [x] You've installed Asciidoctor.
* [x] You've confirmed that the Asciidoctor command line interface (CLI) is available on your PATH.

On this page, you'll learn how to run Asciidoctor on an AsciiDoc document and convert it to HTML.

== Generate HTML using the default converter

Let's generate HTML 5 using Asciidoctor's default converter and stylesheet from an AsciiDoc document.

. To follow along with the steps below, copy the contents of <<ex-my-doc>> into a new plain text file or use your own AsciiDoc document.
+
.my-document.adoc
[#ex-my-doc,asciidoc]
----
include::html-backend:example$my-document.adoc[tags=title;body]
----

. Make sure to save the file with the _.adoc_ file extension.
. Open a terminal and switch (`cd`) into the directory where your AsciiDoc document is saved.
+
 $ cd directory-name

. Call Asciidoctor with the `asciidoctor` command, followed by file name of the AsciiDoc document.
Since HTML 5 is Asciidoctor's default output, we don't need to specify a converter.
+
--
 $ asciidoctor my-document.adoc

As long as the document didn't contain any syntax errors, you won't see any messages printed to your terminal.
--

. Type `ls` to list the files in the directory.
+
--
 $ ls
 my-document.adoc  my-document.html

You should see a new file named [.path]_my-document.html_.
Asciidoctor derives the name of the output file from the name of the input document.
--

. Open [.path]_my-document.html_ in your web browser.
The converted document should look like the example below.
+
--
image::html-backend:my-document.png[]

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 [.path]_my-document.html_ to any computer and it will look the same.
--

TIP: Most of the examples in the general documentation use the CLI, but there are usually corresponding API examples under xref:api:index.adoc[].