Greg,
Whenever you invoke Asciidoctor through an API (either the Ruby one or the Java one), the document is rendered as embeddable HTML (body only, no header & footer). You'll need to explicitly enable the header/footer option in the API.
OptionsBuilder.options().headerFooter(true)
The one exception is when you write directly to disk. Since writing embeddable HTML in a standalone file rarely makes sense, we follow the intent.
The history behind this default in the API is that it was once a requirement for Asciidoctor to run on GitHub. We've kept it for backwards compatibility reasons.
Hopefully that clears things up!
-Dan
UPDATE: When I render the document "in place", then the HTML file on disk appears to have everything. Is this by design?
Attributes attributes = new Attributes();
attributes.setAllowUriRead(true);
attributes.setSkipFrontMatter(true);
File readme = new File(unzippedRoot.getAbsolutePath() + File.separator + "README.adoc");
asciidoctor.renderFile(
readme,
OptionsBuilder.options().safe(SafeMode.SAFE).attributes(attributes).inPlace(true));
content = StreamUtils.copyToString(new FileInputStream(new File(unzippedRoot.getAbsolutePath() + File.separator + "README.html")),
Charset.defaultCharset());
If you reply to this email, your message will be added to the discussion below:http://discuss.asciidoctor.org/asciidoctorj-generates-different-HTML-than-command-line-asciidoctor-tp1137p1138.htmlTo start a new topic under Asciidoctor :: Discussion, email [hidden email]
To unsubscribe from Asciidoctor :: Discussion, click here.
NAML
Free forum by Nabble | Edit this page |