Customize the Substitutions Applied to Text
The inline pass macro (
pass:) accepts the shorthand values in addition to the longhand values for specifying substitution types.
Custom substitutions can also be applied to inline text with the pass macro.
For instance, let’s assume you need to underline a span of text using the HTML element
<u> in your AsciiDoc document.
You’d do this with the inline pass macro.
The text pass:[<u>underline me</u>] is underlined.
The result of Example 1 is rendered below.
The text underline me is underlined.
However, you also need to bold the text and want to use the AsciiDoc markup for that formatting.
In this case, you’d assign the
quotes substitution to the inline pass macro.
The text pass:q[<u>underline *me*</u>] is underlined and the word "`me`" is bold.
The result of Example 2 is rendered below.
The text underline me is underlined and the word “me” is bold.
You can also assign custom substitutions to inline text that’s in a block. In the listing block below, we want to process the inline formatting on the second line.
[subs=+macros] (1) ---- I better not contain *bold* or _italic_ text. pass:quotes[But I should contain *bold* text.] (2) ----
The result of Example 3 is rendered below.
I better not contain *bold* or _italic_ text. But I should contain bold text.