Our docs are written in Asciidoc and published with Antora.
I am using an include for some repeated snippets (e.g. contact us). Per asciidoc rules, each include
has to be on its own line. However, a newline forces a space, which is fine if I need one for the text that follows. But if it’s just a full-stop/period that follows, this looks odd as it has a space before it like this .
instead of what I want like this.
:
This is my current asciidoc (which uses two different partials):
include::partial$contact-support.adoc[]
if you would like to request a feature or get support. You can also join the
include::partial$decodable-slack.adoc[]
.
- I can’t include the full-stop in the partial as it doesn’t always get used at the end of the sentence.
- I could create separate partials for in/end of sentence but it’s a bit clumsy
- I could also rewrite the sentence to put the partial at the end of it. Again, clumsy.
Any suggestions on how to do this in asciidoc? thanks!
Instead of include
, define the boilerplate itself as a macro and put a macro reference in your text. The HTML of the macro definition can go into a passthru so that it is passed along to Asciidoctor’s HTML renderer.
Example:
:boilerplate: pass:[<i>stuff goes here</i>]
Time for some {boilerplate}.
Result: