I have an mydocument.adoc document including a link to the pdf version of itself, How to not include it in the pdf itself, (generated using asciidoctor-pdf) ... still including it when generating the html-5 version, using asciidoctor ?
// tag::pdflink[]
link:mydocument.pdf[pdf version,window=_blank]
// end::pdflink[]
To conditionally exclude (or include) content, you need to use conditionals.
When you run asciidoctor
, the default converter (aka the "backend") is html5
. You can wrap the content you want to exclude in a conditional that checks the intrinsic backend
attribute:
ifeval::["{backend}" == "html5"]
link:mydocument.pdf[pdf version,window=_blank]
endif::[]
For any other backend, such as the pdf
backend, that link won't be included.
See intrinsic attributes for other attributes that asciidoctor
sets automatically for you. Any of them can be used in conditionals.