Over a million developers have joined DZone.
Platinum Partner

How to Convert Asciidoc Text to HTML using Groovy

· Java Zone

The Java Zone is brought to you in partnership with AppDynamics. Discover how AppDynamics steps in to upgrade your performance game and prevent your enterprise from these top 10 Java performance problems.

Here is how you can convert asciidoc text using a Groovy script:

// filename: RunAsciidoc.groovy
@Grab('org.asciidoctor:asciidoctor-java-integration:0.1.3')
import org.asciidoctor.*
def asciidoctor = Asciidoctor.Factory.create()
def output = asciidoctor.renderFile(new File(args[0]),  [:])
println(output);

Now you may run it

groovy RunAsciidoc.groovy myarticle.txt

Many thanks to the asciidoctor.org project!

The Java Zone is brought to you in partnership with AppDynamics. AppDynamics helps you gain the fundamentals behind application performance, and implement best practices so you can proactively analyze and act on performance problems as they arise, and more specifically with your Java applications. Start a Free Trial.

Topics:

Published at DZone with permission of Zemian Deng , DZone MVB .

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}