Define Outline extraction rules in CotEditor on Mac

Define the patterns to extract items in the document for the Outline feature.

To define the rules to extract the outline for a syntax, select Outline from the list on the left of the syntax editor, then add conditions to the list on the right side. See Define a syntax for how to open the syntax editor.

The options for the Outline settings are as follows:

FieldDescription
Regular Expression StringThe strings in the document matched by the regular expressions you set here appear in the outline menu. This setting is required to search the items to be listed.
ICIf selected, the case is ignored for searching. For example, the expression “abc” matches “ABC” or “abc” or “Abc” in your document (IC stands for Ignore Case).
Title PatternHere, you can format the titles of the Outline items. Both the “Regular Expression String” setting and the setting here determine how the corresponding item is titled in the list. You can also make them bold, italic, or underlined.

The meta characters you can use in the Title Pattern are as follows:

MetacharacterDescription
(blank)The whole string matched by your regular expression.
$0The whole string matched by your regular expression.
$1 ... $9The string matched by the first through ninth parenthesized subexpression in your regular expression.
-A separator of the menu (invalid when other letters than “-” are included).

To show a meta character such as “$0” in the menu, you need to put a backslash (\) in front of it. You won’t see that backslash (\) in the menu.

See also