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.

  • c or specialchars

  • q or quotes

  • a or attributes

  • r or replacements

  • m or macros

  • p or post_replacements

Apply substitutions to inline text

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.

Example 1. Inline pass macro syntax
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.

Example 2. Assign quotes to 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.

Example 3. Listing block with inline formatting
[subs=+macros] (1)
----
I better not contain *bold* or _italic_ text.
pass:quotes[But I should contain *bold* text.] (2)
----
1 macros is assigned to subs, which allows the pass macro within the block to be processed.
2 The pass macro is assigned the quotes value. Text within the square brackets will be formatted.

The result of Example 3 is rendered below.

I better not contain *bold* or _italic_ text.
But I should contain bold text.