Awesome Asciidoc: Conditional Directive to Check If Document is On GitHub
In a previous blog post we learned about the conditional directives in Asciidoctor. Dan Allen mentioned a conditional directive that we can use to see if the document is used on GitHub. The conditional directive is called env-github
.
We have the following Asciidoc markup for a document stored on GitHub:
:blogpost: http://mrhaki.blogspot.com/2014/08/awesome-asciidoc-check-if-document-is.html
= Asciidoc on GitHub
Sample document for {blogpost}[Aweseome Asciidoc blog post].
ifdef::env-github[]
This line is only visible if the document is on GitHub.
GitHub is using Asciidoctor {asciidoctor-version}.
endif::env-github[]
ifndef::env-github[This line is visible if not rendered on GitHub.]
To see what is rendered we can view the document on GitHub.
Written with Asciidoctor 1.5.0.