Closed DavidGamba closed 6 years ago
>
is a special character (in HTML), these are substituted by a corresponding character entity in all contexts except pass macro and pass block (see table Substitution groups). Otherwise it would result in invalid HTML. The built-in HTML converter in Asciidoctor behaves the same.
@jirutka I am using this backend to generate confluence XHTML output. Do you know if there is a way to disable the HTML substitutions for the code blocks only? If I apply the subs=none
at the source then it applies to all backends.
[source, subs=none]
----
<b>bold</b>
----
@jirutka That is exacly what I am doing:
[source, subs={code_subs}]
----
<b>bold</b>
----
Then, when building:
# For confluence:
$ asciidoctor -r asciidoctor-html5s -b html5s -a htmlsyntax=xml -a code_subs=none ...
# For html:
$ asciidoctor -a code_subs=normal ...
But I am littering my code with: subs={code_subs}
everywhere, and was hoping I could just disable that on the backend itself.
I was able to accomplish this with a treeprocessor:
class RemoveListingSubsTreeprocessor < ::Asciidoctor::Extensions::Treeprocessor
def process(document)
document.find_by(context: :listing) do |block|
block.subs.clear
end
end
end
Thanks for the great project!
When doing something like:
It replaces to:
Instead of keeping things verbatim. According to https://asciidoctor.org/docs/user-manual/#attributes-2 They shouldn't be substituted.