https://discuss.asciidoctor.org/Attribute-substitution-inside-source-block-tp406p407.html
Emmanuel,
Good news, AsciiDoc provides a way! (which is faithfully implemented by Asciidoctor).
Just about anywhere in AsciiDoc you can control which substitutions are used. In your case, you are interested in the "attributes" substitution.
Here's how to control it.
[source,xml]
[subs="verbatim,attributes"]
.maven dependency
----
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-search</hibernate-search>
<version>{version}</version>
</dependency>
----
(I use two attribute lines to be compatible with AsciiDoc. Asciidoctor properly handles putting them all in one line).
The only downside is that you have to specify all the substitutions you want when you override. That's why the "verbatim" is necessary. "verbatim" is an alias for "specialcharacters,callouts". So the effective substitutions are now "specialcharacters,callouts,attributes".
Please note that this will not work in the preview on GitHub since it was implemented in a later version than they are running (I'm still working on getting them upgraded).
Also, I'll add this to the quick reference guide since the question has come up a few times now.
-Dan