With the release of Asciidoctor 2.0.0 we get nice help on the basic syntax of Asciidoc with the command-line option --help syntax
. This gives us samples of the syntax in Asciidoc markup. As mentioned by Dan Allen on Twitter we can pipe the syntax sample to Asciidoctor itself to get a HTML page:
The best part is, it's valid AsciiDoc. So you can pipe it back to the asciidoctor command to convert it:
— Dan Allen ✊ (@mojavelinux) March 22, 2019
asciidoctor --help syntax | asciidoctor -o syntax.html -
It offers a nice overview of the language and what it can do. Thanks to @Mogztter for his help on this feature!
This is very useful! We have the source and the output of Asciidoc markup with really useful samples.
Let's run Asciidoctor with --help syntax
and convert it to HTML and open the HTML in our web browser: $ asciidoctor --help syntax | asciidoctor -o syntax.html - && open syntax.html
.
We get the following result:
To get the syntax in a Asciidoc markup file we can run $ asciidoctor --help syntax > syntax.adoc
.
Written with Asciidoctor 2.0.2.