37.1.1.4 Managing line breaks in macro definitions

A macro definition does not have to be all on one line; DITA2Go ignores line breaks when processing macros. However, any implicit line breaks in the definition are retained in output when a macro is expanded.

To remove an implicit line break so it does not appear in the output, end the line in question with a backslash “\”.

To remove all implicit line breaks from macros upon expansion:

[Macros]
; OmitMacroReturns = No (default)
;  or Yes (omit macro linebreaks in output)
OmitMacroReturns=Yes

Be aware that omitting all line breaks means that the code generated from each expanded macro—even JavaScript code—ends up all on one line in the output. Few browsers can handle the very long lines that might result.

If you specify OmitMacroReturns=Yes, but still need line breaks in some macros to keep line lengths reasonable in output, you can insert a C-style line terminator “\n” in the definition, even in the middle of a line, wherever you want an explicit line break in the output.

Previous Topic:  37.1.1.3 Escaping special characters in macro definitions

Next Topic:  37.1.1.5 Including comments in macro definitions

Parent Topic:  37.1.1 Defining macros

Sibling Topics:

37.1.1.1 Understanding what a macro definition can include

37.1.1.2 Understanding where you can define named macros

37.1.1.3 Escaping special characters in macro definitions

37.1.1.5 Including comments in macro definitions

37.1.1.6 Obtaining RTF code for macro definitions

Table of ContentsIndex