Re: AsciidoctorJ's "convertFile(s)" methods don't return html
Posted by
abelsromero on
URL: https://discuss.asciidoctor.org/AsciidoctorJ-s-convertFile-s-methods-don-t-return-html-tp2771p2774.html
Seems you're lucky so far, you can indeed pass attributes to the Asciidoctor instance and they will apply to all documents. There's a helper class called
AttributesBuilder that provides a front-end for the more common cases, here is an example:
AttributesBuilder attributes = AttributesBuilder.attributes();
attributes.setAnchors(true);
OptionsBuilder options = OptionsBuilder.options().toFile(false);
options.attributes(attributes.get());
Note that some attributes require some special treatment because Asciidoctor (I mean the ruby backend) deals with some attributes in a special way (e.g. linkcss). Anyway, using the Builder you should be fine.
If you have any trouble with those special cases, you can have a look at this section
https://github.com/asciidoctor/asciidoctorj#conversion-options, and check the main class of the maven plugin (
https://github.com/asciidoctor/asciidoctor-maven-plugin/blob/master/src/main/java/org/asciidoctor/maven/AsciidoctorMojo.java).
In AsciidoctorMojo you will find examples of how to set options, attributes, how to deal with paths, and other issues you may encounter using AsciidoctorJ.
I hope this helps, if you have any other question just ask.