Created
July 6, 2013 10:50
-
-
Save der3k/5939558 to your computer and use it in GitHub Desktop.
Render Asciidoc using Groovy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Grab('org.asciidoctor:asciidoctor-java-integration') | |
import org.asciidoctor.Asciidoctor | |
import org.asciidoctor.Attributes | |
import org.asciidoctor.OptionsBuilder | |
import org.asciidoctor.SafeMode | |
import static org.asciidoctor.Asciidoctor.Factory.create | |
//println 'Starting...' | |
Asciidoctor asciidoctor = create() | |
//println 'Asciidoctor instance created' | |
Attributes attr = new Attributes() | |
attr.linkCss = false | |
attr.dataUri = true | |
Map options = OptionsBuilder.options() | |
.compact(false) | |
.headerFooter(true) | |
.safe(SafeMode.UNSAFE) | |
.backend("html5") | |
.attributes(attr) | |
.asMap() | |
println asciidoctor.render("*This* is it\n\nimage::sunset.jpg[Sunset]\n", options) | |
//println "OK" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for sharing!